sg-socket

3.0.1 • Public • Published

sg-socket

Build Status npm Version JS Standard

WebSocket server for SUGOS

Installation

$ npm install sg-socket --save

Usage

'use strict'
 
const sgSocket = require('sg-socket')
 
const server = sgSocket(8080)
 
server.on('connection', (socket) => {
  socket.emit('app:ready')
  socket.on('app:hey', (data) => {
    socket.broadcast.emit('hi', data.msg)
  })
  socket.on('disconnect', () => {
    socket.broadcast.emit('goodbye, everyone')
  })
})
 

License

This software is released under the Apache-2.0 License.

Links

Readme

Keywords

Package Sidebar

Install

npm i sg-socket

Weekly Downloads

1

Version

3.0.1

License

Apache-2.0

Last publish

Collaborators

  • okunishinishi
  • realglobe