Clean and simple WebSocket client.
Requires as3corelib com.adobe.net.URI class.
Clone from repo:
git clone git://github.com/y8/websocket-as.git y8
Or use as submodule:
git submodule add git://github.com/y8/websocket-as.git y8
import y8.net.WebSocket;
var ws:WebSocket = new WebSocket();
ws.addEventListener("open", function():void { trace("Connection opened"); ws.send("Hello from flash!"); ws.close(); });
ws.addEventListener("close", function():void { trace("Connection closed"); });
ws.addEventListener("message", function(event:*):void { trace("Message: ", event.data); });
ws.addEventListener("error", function(event:*):void { trace("Error: ", event.error); });
ws.open("ws://socket.example.com/path", "http://myapp.example.com");
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don’t break it in a future version unintentionally.
- Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.
websocket-as licensed under Ruby License. See LICENSE for details.
© Alexey Y. Bondar ([email protected]), 2010.