v0.9.1, I've updated to latest now. Haven't happened since :)
Posts made by veggis
Very rarely I get the 'WebSocket is not open: readyState 2' Error. I suspect it happens when the server tries to send to a client that disconnected at the moment it was sent, or something similar.
Do i allways need to check for readystate before send() ?
Thanks
WebSocket is not open: readyState 2 (CLOSING)
Error: WebSocket is not open: readyState 2 (CLOSING)
at WebSocket.send (Y:\UiA\3 År\Bachelor\trianglearcade\server\node_modules\w
s\lib\websocket.js:314:19)
@endel I should've said 'trying to use broadcastPatch'. I didn't want to ovverride it rather add to it, but it ended up being a recursive mess. I instead have a seperate interval for proximity messages.
I guess it could be done with client messages and a seperate update loop, but if i could, i'd rather do it with the patch. Is there such a feature or any nifty suggestions?
Also, is there a way to add methods to patch interval?
Edit: currently using broadcastPatch for this
function setEnumerable(object) {
let private = {};
for (let key in object) {
Object.defineProperty(private, key, {
value: object[key],
enumerable: false,
writable: true
});
}
return private;
}
Will return the passed object with all the items non-enumerable.
After some digging around in the docs I got it. Defining objects non-enumerable does the trick.
@endel Sorry to bother you, but could you give an example with js?
I'm using babel to transcribe decorators, which is working but not for variables.
This is exactly what I was looking for! Thanks alot @endel
Hi! I was wondering, is it possible to reference a room from room ID, say send message to all clients in room?
I have different classes for state, entites, players etc which don't have reference to the parent room class and therefore can't use 'send' method within those classes.
Thanks!