@splytech-io/splyt-ws-message-handler
Splyt WebScoket Message Handler
Last updated 2 years ago by rainder .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @splytech-io/splyt-ws-message-handler 
SYNC missed versions from official npm registry.

Splyt WebSocket Message Handler

Implementation example

'use strict';

const WebSocket = require('ws');
const SplytWSMessageHandler = require('@splytech-io/splyt-ws-message-handler');

//create websocket connection
const ws = new WebSocket(...);
const handler = new SplytWSMessageHandler();

ws.on('connect', (socket) => {

  socket.on('message', (message) => {
    //handle incoming push/request/response messages from the server
    handler.incoming({
      socket: socket,
      incoming: new SplytWSMessageHandler.Incoming(message),
    }).catch((err) => console.error(err));
  });

  //send push/request/response to the client
  handler.outgoing({
    socket,
    outgoing: new SplytWSMessageHandler.Outgoing({
      type: 'request',
      method: 'passenger.config',
    }),
  }).then((result) => console.log(result));

});

Current Tags

  • 0.1.3                                ...           latest (2 years ago)

8 Versions

  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 17
Last Day 0
Last Week 9
Last Month 0
Dependencies (5)
Dev Dependencies (4)

Copyright 2014 - 2017 © taobao.org |