Changeset View
Changeset View
Standalone View
Standalone View
support/aphlict/server/lib/AphlictListener.js
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | getSocket: function() { | ||||
return this._socket; | return this._socket; | ||||
}, | }, | ||||
getDescription: function() { | getDescription: function() { | ||||
return 'Listener/' + this.getID(); | return 'Listener/' + this.getID(); | ||||
}, | }, | ||||
writeMessage: function(message) { | writeMessage: function(message) { | ||||
var serial = JSON.stringify(message); | this._socket.send(JSON.stringify(message)); | ||||
epriestley: WebSockets do framing now. | |||||
var length = Buffer.byteLength(serial, 'utf8'); | |||||
length = length.toString(); | |||||
while (length.length < 8) { | |||||
length = '0' + length; | |||||
} | |||||
this._socket.write(length + serial); | |||||
} | } | ||||
} | } | ||||
}); | }); |
WebSockets do framing now.