0.0.8 • Published 11 months ago

gos-socket-client v0.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Installation

npm i gos-socket-client

Using - only for browsers

  1. Include javascript libraries GeniusesOfSymfony/WebSocketBundle
<script src="{{ asset('bundles/goswebsocket/js/vendor/autobahn.min.js') }}"></script>
<script src="{{ asset('bundles/goswebsocket/js/websocket.min.js') }}"></script>
  1. Check in browser console if GosSocket is available
console.log(GosSocket);
  1. Use GoSocketclient
import {GosSocketClient} from "gos-socket-client";

const wsOptions = {
    url: 'wss://my-web.test/websocket',
    pingChannel: 'ping/channel',
};

const ws = GosSocketClient.getInstance(wsOptions);
ws.subscribe('myChat/channel', () => {});
ws.publish('myChat/channel', {
    msg: 'Hello world',
});
ws.unsubscribe('myChat/channel');
0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

1 year ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago