Implements according to RFC6455.
git clone https://github.com/lzjlxebr/websocket_server.git
cd ./websocket_server
mkdir build && cd $_
cmake .. -DCMAKE_C_COMPILER=gcc
make
./websocket_server
// Make a WebSocket client
let ws = new WebSocket('ws://127.0.0.1:9000/')
// Make client listen for message
ws.onmessage = (e) => { console.log('message:', e.data) }
ws.onclose = (e) => { console.log('message:', e) }
// Send message to server
ws.send('hello')
// Close conncetion
ws.close()
- Handshake opening
- Handshake closing
- Receiving data from client
- Unmask single frame payload
- Unmask multiple frames payload
- Ping & Pong
- Sending data to client
- All platform supported
- Linux
- Darwin
- Windows
- Using Event loop with Reactor pattern
- Multiple process for now
- Using system call
poll
- Event loop
- RFC6455 validations
- Security stuff
- Considering distributed situation