@bcjordan/geckos-io-client
Version:
Real-time client/server communication over UDP using WebRTC and Node.js
51 lines (36 loc) • 2.12 kB
Markdown
<a href="http://geckos.io">
<img src="https://github.com/geckosio/geckos.io/raw/master/readme/logo-256.png" alt="logo" width="128">
</a>
# @geckos.io/client
[](https://www.npmjs.com/package/@geckos.io/client)
[](https://www.npmjs.com/package/@geckos.io/client)

[](https://github.com/geckosio/geckos.io/tree/master/bundles)


[](https://codecov.io/gh/geckosio/geckos.io)
[](https://github.com/yandeu/yandeu/blob/main/posts/2020-05-28-esm-for-nodejs.md)
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](https://github.com/geckosio/geckos.io) for more information.
## Install
```console
npm install @geckos.io/client
```
## Use
```js
import geckos from '@geckos.io/client'
// or add a minified version to your index.html file
// https://github.com/geckosio/geckos.io/tree/master/bundles/versions
const channel = geckos()
channel.onConnect(error => {
if (error) {
console.error(error.message)
return
}
channel.on('chat message', data => {
console.log(`You got the message ${data}`)
})
channel.emit('chat message', 'a short message sent to the server')
})
```