0.0.8 • Published 2 years ago

gos-socket-client v0.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years 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

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago