shxt.geckos.io.server
v2.2.9
Published
<a href="http://geckos.io"> <img src="https://github.com/geckosio/geckos.io/raw/master/readme/logo-256.png" alt="logo" width="128"> </a>
Downloads
4
Readme
@geckos.io/server
Real-time client/server communication over UDP using WebRTC and Node.js.
This framework fits perfectly with your next HTML5 real-time multiplayer games or chat app.
Read the documentation for more information.
Install
npm install @geckos.io/server
How to use
import geckos from '@geckos.io/server'
const io = geckos()
io.listen()
io.onConnection(channel => {
channel.onDisconnect(() => {
console.log(`${channel.id} got disconnected`)
})
channel.on('chat message', data => {
console.log(`got ${data} from "chat message"`)
// emit the "chat message" data to all channels in the same room
io.room(channel.roomId).emit('chat message', data)
})
})