https://github.com/apiorno/ws_server
https://github.com/apiorno/ws_server
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/apiorno/ws_server
- Owner: apiorno
- License: apache-2.0
- Created: 2021-05-23T22:17:01.000Z (about 4 years ago)
- Default Branch: release-candidate
- Last Pushed: 2021-05-23T22:35:43.000Z (about 4 years ago)
- Last Synced: 2025-02-11T12:21:18.656Z (4 months ago)
- Language: Erlang
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ws_server
=====Erlang websocket server using Cowboy library.
Build & start
-----$ rebar3 shell
Testing
-----To open a client connection, from a web browser execute:
```
(()=>{
window.a = new WebSocket("ws://localhost:8080/ws?num=3");
a.onopen = event => console.log("socket opened");
a.onclose = event => console.log("socket closed");
a.onmessage = event => console.log("message received from server: "+event.data);
})();
```Then execute:
```
a.send(5);
```Finally, you can close the connection from the server or from the client executing:
```
a.close();
```