Giter Club home page Giter Club logo

flashsocket.io's Introduction

FlashSocket.IO

Flash client for Socket.IO version 1.0 and above. Connects solely through WebSocket and supports binary data and native TLS (through SecureSocket).

Notes for this fork

This fork is based on redannick/FlashSocket.IO (which itself is based on jimib/FlashSocket.IO) and contains several improvements and bugfixes:

  • support for both polling and websockets
  • upgrade support (by default connect with polling and upgrade to websocket later)
  • support for sending/receiving binary data (as ByteArray)
  • use my fork of AS3WebSocket, with the following improvements:
    • use native SecureSocket for TLS (faster, more sucure, reduces swc size by 86%)
    • limited support for permessage-deflate compression (accept compressed messages from the server, although the client never compresses itself)
  • separate engine.io client code
  • add ERROR event for handling server-side errors
  • bugfix: propertly add callback to messages for sending ACK
  • bugfix: properly clean ACK callbacks
  • bugfix: emit buffered message after dispatching the CONNECT event
  • bugfix: stop heartbeat timer when socket abruptly closes
  • bugfix: dispatch DISCONNECT when connecting is manually close()ed
  • use native JSON
  • remove CLOSE event (unclear semantics), use DISCONNECT instead
  • add destroy() method (similar to the js socket.io-client)

Tested with Socket.IO 1.4.

Sample client and server

A sample client and server are provided. To try them:

  • Install dependencies and start server
cd sample
npm install
npm start
  • Compile the client, eg with mxmlc:
mxmlc --library-path=bin/Flash-Socket.IO.swc sample/client.as

flashsocket.io's People

Contributors

bwillard avatar catoc avatar chatziko avatar cleod9 avatar jimib avatar redannick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

flashsocket.io's Issues

Animate CC [AIR iOS] Set up

Hello,

I'm trying to set this up to work with a service that has socket support.

Their documentation says to use "var socket = io('https://website.com?token={your client_id}:{your client_secret}')

Will this set up work with your solution? I don't see in this example how to specify what webhook specifically I am listening for.

Any help is appreciated.

Security Error

I set up the SSL.CRT and i host the server on cloud9.io but i get a security error. Any help?
It connects and works from flash but when i test it outside flash as a swf it doesn't work.

version 2

Any plans to update this lib to 2.0 socket io?

License?

Hi, my team would like to use this but we noticed there isn't a license included in the project. Would you mind posting an MIT or other simple open source license to this? Thanks.

Reconnection support?

I am trying to use this client library with socket.io 2.3.0 and it mostly works fine, but because of the relatively low ping timeout of 5000ms, the client sometimes disconnects during brief periods of network lag/outage.
A quick fix solution is to just increase the timeout to some large number (60000 ms or so), but that has other unfortunate consequences.

The official socket.io-client JS library solves this by implementing automatic reconnection. Is this something that could easily be added to this library? If so, could you give me some pointers on how to modify FlashSocket.IO to support it?

From https://socket.io/docs/:
Unless instructed otherwise a disconnected client will try to reconnect forever, until the server is available again.

References:

  1. manager.js - Reconnection in Socket.IO-client JS

  2. Socket.IO Client "Manager" docs

Got it connecting but how to request specific calls?

I'm trying to connect to an existing API socket-io websocket offered through an API I'm using. Their docs say in JS to listen like this

// Listen for trip:finished event
socket.on('trip:finished', function(eventJSON) {
console.log('Trip Finished', eventJSON);
});

// Handle error messages
socket.on('error', function(errorMessage) {
console.log('Error', errorMessage);
});

How can I specify I want to list to trip:finished using this solution?

IWebSocketWrapper was not found

Getting the following error despite all files being in the correct folders, etc.

/com/pnwrain/flashsocket/FlashSocket.as, Line 21, Column 62 1045: Interface IWebSocketWrapper was not found.

Doesnt use WebSocket but Polling

I got everything working but when i tries to use transport "websocket" it gets an error:

FlashSocket: "probe transport failed because of error: " "websocket" {"data":"ioError","bubbles":true,"cancelable":false,"type":"error","target":{"opts":{"upgrade":true,"sid":"1OwuHs1KVhx8pMBWAAAC","secure":true,"protocol":"http","query":"","transports":["polling","websocket"],"host":"localhost:8081","channel":"/"},"writable":false,"pausable":false,"name":"websocket"},"currentTarget":{"opts":{"upgrade":true,"sid":"1OwuHs1KVhx8pMBWAAAC","secure":true,"protocol":"http","query":"","transports":["polling","websocket"],"host":"localhost:8081","channel":"/"},"writable":false,"pausable":false,"name":"websocket"},"eventPhase":2}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.