@pouchsdk/realtor
v1.0.1
Published
blazing fast socket.io alternative,pure websockets.
Downloads
136
Maintainers
Readme
@pouchsdk/realtor
blazing fast socket.io alternative,pure websockets.
install
npm install @pouchsdk/realtor
server usage
import {Realtor} from '@pouchsdk/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 '@pouchsdk/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 realtor,help maintain its development,this keeps the maintainer motivated