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
Currently, if you start a server, it will always receive data via onread() because of JSSocket.h#L79.
This is a bit confusing, is this a wanted API? It will eventually lead to users having to create a cache for both their wrappers and the nidium sockets, just to answer to the corresponding socket correctly.
letserver=newSocket('127.0.0.1',1234).listen('tcp');server.onaccept=function(socket){socket.onread=function(data){// XXX: Never actually firedconsole.log('this is a much better API, per-client onread',data);};};server.onread=(socket,data)=>console.log('server.onread always fired',data);
The text was updated successfully, but these errors were encountered:
The issue with the "expected behavior" your described is that it creates a new function per client.
This could be an issue when having to deal with a lot of objects.
Anyway, we can still do it and keep both API (server.onread + per-socket onread) ?
e.g. don't fire server.onread if socket has onread defined?
Currently, if you start a server, it will always receive data via
onread()
because of JSSocket.h#L79.This is a bit confusing, is this a wanted API? It will eventually lead to users having to create a cache for both their wrappers and the nidium sockets, just to answer to the corresponding socket correctly.
Example 1 (current behaviour)
Example 2 (expected behaviour)
The text was updated successfully, but these errors were encountered: