Exposed as the io global in window if using the standalone build (eg: /socket.io/socket.io.js or the CDN), or the result of calling require('socket.io-client').
When called, it creates a new Manager for the given URL, and attempts to reuse an existing Manager for subsequent calls, unless the multiplex option is passed with false. Passing this option is the equivalent of passing 'force new connection': true.
The rest of the options are passed to the Manager constructor (see below for details).
A Socket instance is returned for the namespace specified by the pathname in the URL, defaulting to /. For example, if the url is http://localhost/users, a transport connection will be established to http://localhost and a Socket.IO connection will be established to /users.
Socket.io protocol revision number this client works with.
Reference to the Socket constructor.
Reference to the Manager constructor.
Reference to the Emitter constructor.
A Manager represents a connection to a given Socket.IO server. One or more Socket instances are associated with the manager. The manager can be accessed through the io property of each Socket instance.
The opts are also passed to engine.io upon initialization of the underlying Socket.
Options: – reconnection whether to reconnect automatically (true) – reconnectionDelay how long to wait before attempting a new reconnection (1000) – reconnectionDelayMax maximum amount of time to wait between reconnections (5000). Each attempt increases the reconnection by the amount specified by reconnectionDelay. – timeout connection timeout before a connect_error and connect_timeout events are emitted (20000)
connect. Fired upon a successful connection.connect_error. Fired upon a connection error.Object error objectconnect_timeout. Fired upon a connection timeout.reconnect. Fired upon a successful reconnection.Number reconnection attempt numberreconnect_attempt. Fired upon an attempt to reconnect.reconnecting. Fired upon an attempt to reconnect.Number reconnection attempt numberreconnect_error. Fired upon a reconnection attempt error.Object error objectreconnect_failed. Fired when couldn’t reconnect within reconnectionAttempts
The events above are also emitted on the individual sockets that reconnect that depend on this Manager.
Sets the reconnection option, or returns it if no parameters are passed.
Sets the reconnectionAttempts option, or returns it if no parameters are passed.
Sets the reconectionDelay option, or returns it if no parameters are passed.
Sets the reconectionDelayMax option, or returns it if no parameters are passed.
Sets the timeout option, or returns it if no parameters are passed.
connect. Fired upon connecting.error. Fired upon a connection errorObject error datadisconnect. Fired upon a disconnection.reconnect. Fired upon a successful reconnection.Number reconnection attempt numberreconnect_attempt. Fired upon an attempt to reconnect.reconnecting. Fired upon an attempt to reconnect.Number reconnection attempt numberreconnect_error. Fired upon a reconnection attempt error.Object error objectreconnect_failed. Fired when couldn’t reconnect within reconnectionAttempts
© 2014–2015 Automattic
Licensed under the MIT License.
http://socket.io/docs/client-api