Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

19 lines (16 sloc) 0.627 kb
Also, if you want to intercept the raw string messages and do your own handling in some cases, you can leave out the `require('ws-rpc').extend(wss);` line above, and do the following:
```js
wss.on('connection', function(client) { // notice: "connection" vs "connect"
client.on('message', function(data, flags) {
if(is_my_message(data)) {
// handle the raw message here
// ...
// notify the RPC extension that this message was already handled
flags.handled = true;
}
// otherwise the message will be handled as RPC
});
});
// only setup the RPC extension after the above
require('ws-rpc').extend(wss);
```
Jump to Line
Something went wrong with that request. Please try again.