New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify websockets framing. #28

Closed
majek opened this Issue Dec 8, 2011 · 7 comments

Comments

Projects
None yet
2 participants
@majek
Copy link
Member

majek commented Dec 8, 2011

@mrjoes on the mailing list http://groups.google.com/group/sockjs/browse_thread/thread/709ae905e315e1a6 noticed that once in the sockjs-protocol we do:

    ws.send(u'["a"]')
    self.assertEqual(ws.recv(), u'a["a"]')

and later:

    ws1.send(u'"a"')
    self.assertEqual(ws1.recv(), u'a["a"]')
@majek

This comment has been minimized.

Copy link
Member Author

majek commented Dec 14, 2011

Bad news. Sockjs-client is using the form that isn't documented in the framing section of the protocol spec, ie: it just pushes raw string, without the parenthesis:

https://github.com/sockjs/sockjs-client/blob/67af34fc94df4fd08415c0d1aad6ad9dd2b048bc/lib/sockjs.js#L214
https://github.com/sockjs/sockjs-client/blob/67af34fc94df4fd08415c0d1aad6ad9dd2b048bc/lib/trans-websocket.js#L33

@majek

This comment has been minimized.

Copy link
Member Author

majek commented Mar 16, 2012

I decided to always use squares - like ["a"] .

The disadvantage is two bytes more per message.

But it will give us a tiny bit more flexibility in the future. (I'm thinking about support for binary data already).

Hopefully this was long tested by sockjs-protocol so the core protocol doesn't need to change.

@majek majek closed this Mar 19, 2012

@majek

This comment has been minimized.

Copy link
Member Author

majek commented Mar 20, 2012

Btw, the framing with square brackets was tested for a long time here:

ws.send(u'["a"]')

@fafhrd91

This comment has been minimized.

Copy link

fafhrd91 commented Mar 20, 2012

i think all essential tests should be moved to latest version of protocol (WebsocketHybi10) or at least should be duplicated
in both hixie and hybi

@majek

This comment has been minimized.

Copy link
Member Author

majek commented Mar 20, 2012

Agreed. Please file a bug if you have anything particular in mind.

@fafhrd91

This comment has been minimized.

Copy link

fafhrd91 commented Mar 20, 2012

ah, i see sockjs-protocol-dev.py already sends message with square brackets

@majek

This comment has been minimized.

Copy link
Member Author

majek commented Nov 20, 2012

Continued: #61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment