1

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.

C19
  • 738
  • 2
  • 7
  • 16
  • Specifically in your case, I'm not sure that the chart data should be websocket based... It sounds too much like downloading, where AJAX or simple HTTP would provide a better solution. If the chart has live-updates, I believe only those updates should be sent through websockets. – Myst Jun 06 '15 at 05:23

1 Answers1

3

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?

Community
  • 1
  • 1
u.k
  • 3,091
  • 1
  • 20
  • 23