Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pubnub/pubnub-actionscript
Awesome ActionScript 3 (Flash) SDK for Publish/Subscribe on PubNub Real-time Network - http://www.pubnub.com
https://github.com/pubnub/pubnub-actionscript
Last synced: about 2 months ago
JSON representation
Awesome ActionScript 3 (Flash) SDK for Publish/Subscribe on PubNub Real-time Network - http://www.pubnub.com
- Host: GitHub
- URL: https://github.com/pubnub/pubnub-actionscript
- Owner: pubnub
- Created: 2013-09-13T05:50:15.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-07T19:46:12.000Z (about 10 years ago)
- Last Synced: 2024-08-04T05:05:01.538Z (5 months ago)
- Language: ActionScript
- Homepage:
- Size: 439 KB
- Stars: 1
- Watchers: 17
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-actionscript-sorted - pubnub-actionscript - Awesome ActionScript 3 (Flash) SDK for Publish/Subscribe on PubNub Real-time Network - http://www.pubnub.com (API / Other API)
README
# PubNub Adobe Air ActionScript 3 SDK
This is a brand new rewrite of the Flash SDK with
a massive improvement on performance and reliability.### Simple Example
```javascript
package {
import flash.display.Sprite;
import com.pubnub.PubNub;public class Main extends Sprite {
public function Main() {// Setup
var pubnub:PubNub = new PubNub({ message : function message(
message:Object,
channel:String,
timetoken:String,
age:Number
):void {
trace('message:',message); // Message Payload
trace('channel:',channel); // Channel Source
trace('timetoken:',timetoken); // PubNub TimeToken
trace('age:',age); // Aproxmate Age
} });// Add Channels
pubnub.subscribe({ channels : [ 'a', 'b', 'c' ] });}
}
}
```### Import PubNub Client
```javascript
import com.pubnub.PubNub;
```### Full Init PubNub Client
To see full usage example, visit the `Main.as` file.
```javascript
var pubnub:PubNub = new PubNub({
publish_key : "demo", // Publish Key
subscribe_key : "demo", // Subscribe Key
uuid : "USER_ID", // User ID of Connection
drift_check : 60000, // Re-calculate Time Drift (ms)
ssl : false, // SSL ?
cipher_key : 'mypass', // AES256 Crypto Password
message : message, // onMessage Receive
idle : idle, // onPing Idle
connect : connect, // onConnect
reconnect : reconnect, // onReconnect
disconnect : disconnect // onDisconnect
});
```### Add Channels
```javascript
pubnub.subscribe({ channels : [ 'b', 'c' ] });
```### Remove Channels
```javascript
pubnub.unsubscribe({ channels : [ 'b', 'c' ] });
```### Publish Message
```javascript
pubnub.publish({
channel : 'b',
message : 'Hello!',
response : function(r:Object):void {
trace('publish:',JSON.stringify(r));
}
});
```