This repository was archived by the owner on Mar 21, 2020. It is now read-only.
File tree 1 file changed +2
-62
lines changed
1 file changed +2
-62
lines changed Original file line number Diff line number Diff line change 1
- # Community
2
- [ Slack] ( https://wxapp-socket-io.slack.com )
3
-
4
- # weapp-socket-io
5
-
6
- 微信小程序的 Socket.io client 实现,** 压缩之后体积为 16K**
7
-
8
- > 为了让开发者以最低的成本上手,本类库封装了与 socket.io 一致的 API 供开发者调用。
9
-
10
- # Demo
11
- 使用 socket.io 官网的 chat demo server 实现的 小程序版 聊天室应用
12
- 使用 “微信开发者工具” 将 ` weapp_demo ` 目录打开,运行调试即可
13
-
14
- # Features
15
- 目前已支持
16
- * Namespace
17
- * Singleton
18
- * Reconnect
19
-
20
- # Build
21
- ` npm run build `
22
-
23
- 生产环境可使用 ` NODE_ENV=production npm run build ` 进行压缩编译
24
-
25
- # How to use
26
-
27
- ### npm
28
- ` npm install wxapp-socket-io `
29
-
30
- ### manual
31
-
32
- 拷贝 dist 目录的 index.js 文件到你的项目目录,并 require
33
-
34
- ` const io = require('yourPath/build/index.js') `
35
-
36
-
37
- 为了使用风格与 socket.io 完全一致
38
-
39
- ``` javascript
40
- const news = io (' ws://localhost:9999/news' )
41
- news .on (' news' , function (data ) {
42
- console .log (' ======news data: ' , data)
43
- news .emit (' old' , ' 1234abc' )
44
- })
45
-
46
- const chat = io (' ws://localhost:9999/chat' )
47
- console .log (' chat: ' , chat)
48
- chat .on (' chat' , function (data ) {
49
- console .log (' ======chat data: ' , data)
50
- chat .emit (' comment' , ' Hi server chat' )
51
- })
52
- ```
53
- # Collaborator
54
-
55
- + [ gongzili] ( https://github.com/gongzili456 )
56
- + [ C.C.] ( https://github.com/fanweixiao )
57
-
58
- # TODO
59
- + emit buffer
60
- + Binary support
61
- + Room 的支持
62
- + Smaller size
1
+ 此项目已经不在维护, 请移步 [ weapp.socket.io] ( https://github.com/wxsocketio/weapp.socket.io )
2
+ 体验新版本
You can’t perform that action at this time.
0 commit comments