2

Suppose I have a service which requires to seek the database for different data once and in a while. For this I have 2 or 3 SSE, each one with a different retry basetime (20000 miliseconds, 1000 miliseconds...). What I'd like to know is if websockets can handle different "data type" accordingly to the request, for example, could I create one websocket to handle a notification system, a chat system, a group system instead of separated SSEs and treat data differently with javascript? And if so, would it be of higher interest (performance) than actually performing different queries to the server through different SSEs?

If this is possible then would it be bad design to create multiple sockets for each service here?

  • 2
    What is an SSE? Anyway, you can send whatever you want to over a websocket. You can send a packet with a header that specifies the data type, and then deserialize the remaining data from the packet into the appropriate object. – Robert Harvey May 27 '14 at 19:56
  • @RobertHarvey it's Streaming SIMD Extensions – Jimmy Hoffa May 27 '14 at 20:04
  • 3
    @RobertHarvey Server Sent Events – user3385828 May 27 '14 at 20:47
  • 3
    Why wouldn't you be able to? A websocket is just a communications channel, is it not? You would only need separate websockets if you were communicating with separate servers. – Robert Harvey May 27 '14 at 20:52
  • 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.