WebSocket ActionScript Client

来源:互联网 发布:java static volatile 编辑:程序博客网 时间:2024/05/22 00:26
WebSocket ActionScript Client

Clean and simple WebSocket client.

Requires as3corelib com.adobe.net.URI class.

Usage example

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");

Note on Patches/Pull Requests

  • 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.

License

websocket-as licensed under Ruby License. See LICENSE for details.

Copyright

© Alexey Y. Bondar (y8@ya.ru), 2010.

原创粉丝点击