1.0.2 • Published 8 years ago

@meteor-it/xpress-support-potato v1.0.2

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
8 years ago

XPress Potato Socket support

What is Potato Socket?

This is a Websocket wrapper with packet (de)serialization tougth ProtoDef Also supports RPC

Read instruction in XPress to install

Usage:

server.on('POTATO /*',async(req, socket, next)=>{
    // Req here - custom object, have all props as on normal http requests
    // All types from protodef
    socket.addPacket('packetName',{
      field1:'string',
      field2:'i8',
      ...
    });
    next(); 
});
server.on('POTATO /a',async(req, socket, next)=>{
    req.a; // = 123
    socket.on('packetName', msg=>console.log.bind(console));
    // RPC
    await socket.remoteFunc(params)
});

Also see the potato.socket docs

1.0.2

8 years ago

1.0.1

8 years ago