socket-client-apipost
TypeScript icon, indicating that this package has built-in type declarations

0.0.22 • Public • Published

A-Design Logo

socket-client-apipost 是一个用于ApiPost连接socket的模块。

🎉 特性

  • 支持类型
  • Raw,SockJs,SocketIo v2 v3 v4

安装

npm i socket-client-apipost

基础使用

需引入:

import scoketClient from 'socket-client-apipost';
const scoket = new scoketClient(); 

scoket.connect(apipostApi) // 建立连接
scoket.onmessage(id,(data)=>data); // 接收消息
scoket.onclose(id,(data)=>data); // 关闭连接回调
scoket.onconnect(id,(data)=>data); // 成功连接回调
scoket.onerror(id,(err)=>err); // 异常回调
scoket.send(id,'hello'); // 发送消息
socket.close(id); // 关闭连接

开源协议

socket-client-apipost 遵循 MIT 协议

Readme

Keywords

none

Package Sidebar

Install

npm i socket-client-apipost

Weekly Downloads

1

Version

0.0.22

License

MIT

Unpacked Size

59.1 kB

Total Files

6

Last publish

Collaborators

  • chengyang12138
  • proud_lion
  • lee-meng
  • wjzhangq
  • apipost-lab001
  • xbw19975