client-socket-gateway
v1.0.3
Published
This package helps a client receive messages from a web socket
Downloads
3
Maintainers
Readme
Using Client Socket Gateway
Library Installation
npm install client-socket-gateway
- This will install the library into your code and you can now use it
Library Usage
- To use the library, import it in the file where your entry file is like this
import { gateway } = require("client-socket-gateway")
- Now initialize it
// Requires socketUrl and clientId
gateway.getResponse(socketUrl, clientId)
- When you initialize it, ensure to pass the socketUrl, that is from your backend and the clientId so that your client can only receive specific messages.
- Now you are able to receives messages and you can do so like below
gateway.getResponse(socketUrl, clientId)
.then((response) => {
console.log(response)
})