Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/streetstrider/booth

Booth provides symmetric Event API over websocket or unix domain socket
https://github.com/streetstrider/booth

flyd frp node promise realtime request socket socket-io socketio stream

Last synced: 7 days ago
JSON representation

Booth provides symmetric Event API over websocket or unix domain socket

Awesome Lists containing this project

README

        

# booth

> Booth provides symmetric Event API over websocket or unix domain socket

Alike socket.io, but less powerful. Simple Event API, simple reconnect strategy,
symmetric usage via `Endpoint()` on both client and server sides.

# api
```js
/*
* options: WebSocket.Server options
*/
const booth = Booth(options)

/* port */
const booth = Booth({ port: 9000 })

/*
* httpServer instance
* for using inside working http server
* or with unix domain socket
*/
const booth = Booth({ server })

booth.on('name', handler)
booth.on({ name: handler })

function handler (data, endpoint) { /* … */ }

/*
* ws_uri: string with ws or ws+unix uri
*/
Endpoint(ws_uri)

/* websocket */
Endpoint('ws://localhost:9000')

/* unix domain socket */
Endpoint('ws+unix:///tmp/booth/unix.sock')

endpoint.on('name', handler)
endpoint.on({ name: handler })

function handler (data, endpoint) { /* … */ }
```

# license
ISC.
Copyright © 2022, Strider.