Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuri2peter/socket-me
一个支持开放socketio客户端协议的服务端,很适合作为其他小的联机应用的公共服务器。
https://github.com/yuri2peter/socket-me
Last synced: about 2 months ago
JSON representation
一个支持开放socketio客户端协议的服务端,很适合作为其他小的联机应用的公共服务器。
- Host: GitHub
- URL: https://github.com/yuri2peter/socket-me
- Owner: yuri2peter
- License: mit
- Created: 2022-07-03T02:08:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-03T03:48:05.000Z (over 2 years ago)
- Last Synced: 2024-04-16T14:08:18.473Z (9 months ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# socket-me
一个支持开放 socketio 客户端协议的服务端,很适合作为其他小的联机应用的公共服务器。
## SocketIO Versions
- 服务端:4.5.1
- 客户端:4.5.0对于客户端,推荐使用 CDN:
```html
```
## Quick Start
```html
socket-me
(() => {
// replace <server-host> with true hostname.
const socket = io('http://<server-host>');
socket.on('connect', () => {
console.log('socket connected.');
socket.emit('join', {
room: 'room-1',
name: 'yuri',
});
socket.emit('speak', {
to: { name: 'yuri' },
data: { msg: 'I am trying to speak to myself.' },
});
});
socket.on('speak', eventData => {
console.log(eventData);
});
socket.on('disconnect', () => {
console.log('socket disconnected.');
});
})();
```