-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Add support of msgpack format #1652
Comments
i think alternative formats would serve better as plugins. I'd be happy to merge in any hooks needed to make that happen. Thought, @rauchg? |
Agreed on hooks. Pluggable codecs is something we've been meaning to introduce for a while! |
It'd be interesting to test the performance of a demo app that shows users cursors on a page in realtime using the default codec and a custom codec that can only receive integer tuples over a binary stream (x,y). In other words: io.emit('position', x, y) could be encoded in a very minimal way instead of using JSON. |
any progress on this? I have msgpack working via monkey-patching - something I would like to avoid. |
Related: #1946 |
Question: aren't most users already using something like |
@darrachequesne that is the only way to do it right now, but it would be far more convenient if there were a way to preprocess all outgoing and incoming messages automatically. As far as hooks go, what would you like them named? I was thinking something like: serverconst socket = new SocketIO(httpServer, {
prepareMessage: msgpack.encode,
unprepareMessage: msgpack.decode,
}) clientconst socket = new SocketIO({
prepareMessage: msgpack.encode,
unprepareMessage: msgpack.decode,
}) |
Or closer to the request in #1946, serverconst codec = {
encode: msgpack.encode,
decode: msgpack.decode,
}
const socket = new SocketIO(httpServer, {
codec,
}) clientconst codec = {
encode: msgpack.encode,
decode: msgpack.decode,
}
const socket = new SocketIO({
codec,
}) |
Maybe something like the following? That would allow to use not only msgpack, but also protobuf or schemapack (among others). Question: since Example: {
type: parser.EVENT,
data: ['hello', 'world'],
id: 1,
nsp: '/test'
} |
That may make sense too: socketio/socket.io-parser#61 |
What do you think of #2829? |
Closed by #2829. |
I think it will be useful to add support of msgpack and have ability to switch between json and msgpack formats in configuration. http://msgpack.org/
The text was updated successfully, but these errors were encountered: