C19
C19

Reputation: 758

Should multi websocket connection used to achieve parallel communication?

Say, one is responsible for large chunk of chart data.

another is responsible for update user info.

is this appropriate? I'm not sure that how js is single threaded would influence this.

Upvotes: 1

Views: 524

Answers (1)

u.k
u.k

Reputation: 3091

Since WebSockets has an asynchronous API, the number of sockets you use is not the blocking factor. Actually, if you have one socket that does heavy processing per event it is more likely to be blocking the single thread.

This could help you grasp how async works in javascript How does JavaScript handle AJAX responses in the background?

Upvotes: 3

Related Questions