@pouchlab/realtor
v2.0.2
Published
a blazing fast socket.io alternative,pure websockets
Downloads
1
Maintainers
Readme
pouchrealtor
blazing fast socket.io alternative,pure websockets.
its a pure websocket for nodejs and browser,draws inspiration from socket.io.if you know socket.io you already know pouchrealtor
features
- pure websockets
- blazing fast
- works in nodejs and browser
- easy rooms logic
install
npm install @pouchlab/realtor
server usage
import {Realtor} from '@pouchlab/realtor';
import express from 'express';
//with express
const app = express()
const realtime = new Realtor({server:app})//expects object
console.log(realtime)
//room
let chatroom = new realtime.Room('/chat')
console.log(chatroom)
//events
chatroom.emit('welcome',{msg:'hi from server'},(res)=>{
console.log(res)
})
chatroom.on('welcome',(socket)=>{
console.log(socket)
})
app.listen(3000)
client usage
import {CreateClient} from '@pouchlab/realtor';
let client = createClient('ws://localhost:3000/chat')//ws or wss only
//events
client.emit('welcome',{msg:'hi from server'},(res)=>{
console.log(res)
})
client.on('welcome',(res)=>{
console.log(res)
})
support
if you like pouchrealtor,help maintain its development,this keeps the maintainer motivated