1.0.0 • Published 1 year ago
@jbl-system/messenger v1.0.0
This is a wrapper around socket.io-client for JBL System.
How to use
Install using npm
with:
npm i @jbl-system/messenger
import Messenger from "@jbl-system/messenger"
useEffect(() => {
socket = socket || new Messenger(baseURI.notification, true)
socket.onEvent('connect', () => {
socket.Subscribe('webScanner', ['position-pinned', 'update-last-position', 'position-updated']);
});
socket.onEvent('reconnect', () => {
socket.Subscribe('webScanner', ['position-pinned', 'update-last-position', 'position-updated']);
});
socket.onEvent('update-last-position', (data: TRowLastPosition) => {
....
});
return () => {
socket = socket.disconnect()
};
}, []) ...
1.0.0
1 year ago