Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hachibeedi/haxe-websocketserver
WebsocketServer on Haxe/Neko
https://github.com/hachibeedi/haxe-websocketserver
haxe neko websocket-server
Last synced: about 2 months ago
JSON representation
WebsocketServer on Haxe/Neko
- Host: GitHub
- URL: https://github.com/hachibeedi/haxe-websocketserver
- Owner: hachibeeDI
- Created: 2013-11-12T11:50:28.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-22T03:59:14.000Z (over 10 years ago)
- Last Synced: 2024-10-18T14:31:06.880Z (4 months ago)
- Topics: haxe, neko, websocket-server
- Language: Haxe
- Size: 219 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/hachibeeDI/Haxe-WebsocketServer.png?branch=master)](https://travis-ci.org/hachibeeDI/Haxe-WebsocketServer)
# Haxe-WebsocketServer 0.0.0.1
Haxe製WebsocketServer。
This is websocketserver implemented by Haxe.### Targets
neko only
## Install
`$ haxelib git nyansocket https://github.com/hachibeeDI/Haxe-WebsocketServer.git`
### Example
```
-lib nyansocket
-main Main
-neko main.n# if you don't need server stateus trace, append the following option
#--no-traces
``````javascript
package ;import neko.net.websocket.WebSocketServer;
class Main {
public static function main() {
trace("start server");
var webs = new WebSocketServer();
// add event listener
webs.onmessage.push(
function(client_self, msg) {
webs.broad_cast(msg, client_self);
}
);
webs.run("localhost", 1234);
trace("server halt");
}
}
``````html
var ws = new WebSocket("ws://localhost:1234");
ws.onopen = function (e) {
console.log(e);
};
ws.onclose = function (e) {
console.log(e);
};
ws.onmessage = function (e) {
console.log(e);
console.log(e.data);
};ws.send('Hello Server!');
```