@sevenqi/nodechannel
v1.1.6
Published
nodejs channel
Downloads
5
Maintainers
Readme
Supported Protocols
|Protocol Name| Supported | | ---- | :----: | | TcpSocket | ☑ | | UdpSocket | ☑ | | Hid | ☑ | | SerialPort | ☑ |
Used libs
node-serialport node-hid uuid ws
GetStarted
Install
npm install @sevenqi/nodechannel
Client Example
WebSocket
const sessionManager = new SessionManager();
const sessionId = sessionManager.add({
channelType: ChannelType.WebSocket,
channelOptions: {
options: { address: "ws://0.0.0.0:8888" },
filter: StringFilter
}
})
sessionManager.onData(sessionId, (message: any) => {
console.log("消息:", message)
})
const isConnected = await sessionManager.connect(sessionId);
if (isConnected)
SessionManager.send(sessionId, Buffer.from("hello world"))