Utilities to embed and communicate with the Flash player from Javascript
Provides a simple socket connection using WebSocket, or alternate communication mechanisms in legacy browsers for comet-style communication. This is based on the WebSocket API and returns an object that implements the WebSocket interface: http://dev.w3.org/html5/websockets/#websocket
Provides socket connections. This can be used with virtually any Comet protocol.
| Parameter | Type | Description |
|---|---|---|
| argsOrUrl | Object | This uses the same arguments as the other I/O functions in Dojo, or a URL to connect to. The URL should be a relative URL in order to properly work with WebSockets (it can still be host relative, like //other-site.org/endpoint) |
An object that implements the WebSocket API
dojo.require("dojox.socket");
var socket = dojox.socket({"url://comet-server/comet");
// we could also add auto-reconnect support
// now we can connect to standard HTML5 WebSocket-style events
dojo.connect(socket, "onmessage", function(event){
var message = event.data;
// do something with the message
});
// send something
socket.send("hi there");
whenDone(function(){
socket.close();
});
You can also use the Reconnect module:
dojo.require("dojox.socket");
dojo.require("dojox.socket.Reconnect");
var socket = dojox.socket({url:"/comet"});
// add auto-reconnect support
socket = dojox.socket.Reconnect(socket);
| Parameter | Type | Description |
|---|---|---|
| format | String | |
| filler | mixed... |