You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe Socket.on is not generic enough, as it stand now it is:
let on = (socket, func) =>
_on(socket, "message", obj => func(Json.fromValidJson(obj)));
But looking at the docs Socket.IO Documentation, socket.io should support different types of events:
io.on('connection',function(socket){socket.emit('request',/* */);// emit an event to the socketio.emit('broadcast',/* */);// emit an event to all connected socketssocket.on('reply',function(){/* */});// listen to the event});
So the above would be like this:
let on = (socket, event, func) =>
_on(socket, event, obj => func(Json.fromValidJson(obj)));
The design decision here is however to support switch statement match; shouldn't user have option to do it the standard way through optional parameter?
The text was updated successfully, but these errors were encountered:
Hey! Yup the design is to enable pattern matching, and socket.io’s design is closely tied to JS and it’s semantics. Why would you like to send stringly-typed messages?
One good reason could be to communicate with an existent backend/frontend. In which case I could imagine exposing some unsafe functions.
I believe Socket.on is not generic enough, as it stand now it is:
But looking at the docs Socket.IO Documentation, socket.io should support different types of events:
So the above would be like this:
The design decision here is however to support switch statement match; shouldn't user have option to do it the standard way through optional parameter?
The text was updated successfully, but these errors were encountered: