dojo/main.dojox (version 1.10)

Property Summary

Method Summary

  • socket(argsOrUrl) Provides a simple socket connection using WebSocket, or alternate communication mechanisms in legacy browsers for comet-style communication.
  • sprintf(format,filler)

Properties

analytics
Defined by: dojox/analytics/_base
app
Defined by: dojox/app/Controller
atom
av
Defined by: dojox/av/FLAudio
BidiComplex
calc
Defined by: dojox/calc/_Executor
calendar
charting
collections
color
css3
Defined by: dojox/css3/fx
data
date
dgauges
drawing
Defined by: dojox/drawing/Drawing
dtl
Defined by: dojox/dtl/_base
editor
embed
Defined by: dojox/embed/Flash
encoding
Defined by: dojox/encoding/_base
flash
Defined by: dojox/flash/_base

Utilities to embed and communicate with the Flash player from Javascript

form
fx
gantt
gauges
geo
gesture
Defined by: dojox/gesture/Base
gfx
Defined by: dojox/gfx/_base
gfx3d
Defined by: dojox/gfx3d/_base
grid
Defined by: dojox/grid/_Events
help
Defined by: dojox/help/console
highlight
Defined by: dojox/highlight/_base
html
Defined by: dojox/html/_base
image
Defined by: dojox/image/Badge
io
Defined by: dojox/io/OAuth
jq
Defined by: dojox/jq
json
jsonPath
Defined by: dojox/jsonPath/query
lang
layout
math
mdnd
Defined by: dojox/mdnd/Moveable
mobile
mvc
openlayers
rails
Defined by: dojox/rails
robot
Defined by: dojox/robot/recorder
rpc
secure
sketch
Defined by: dojox/sketch/_Plugin
sql
Defined by: dojox/sql/_base
string
testing
Defined by: dojox/testing/DocTest
timing
Defined by: dojox/timing/Sequence
treemap
uuid
Defined by: dojox/uuid/_base
validate
Defined by: dojox/validate/_base
widget
xml
Defined by: dojox/xml/parser

Methods

socket(argsOrUrl)
Defined by dojox/socket

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)

Returns:any | undefined

An object that implements the WebSocket API

Examples

Example 1

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);
sprintf(format,filler)
Parameter Type Description
format String
filler mixed...
Error in the documentation? Can’t find what you are looking for? Let us know!