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
{{ message }}
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This would minimize object creation when trying to implement socket pooling. For example:
letTCPSocketPool=[];// populate socket poolfor(leti=11;--i;){TCPSocketPool.push(newTCPSocket());}// when a socket it needed, instead of constructing a new object, just call:letsocket=TCPSocketPool.shift();// use socketsocket.connect("127.0.0.1","9001");// ...// send back to pool when donesocket.onclose=function(){TCPSocketPool.push(this);};
This separation of creating the socket and connecting would be more familiar to developers with Unix socket programming backgrounds as well.