PageRenderTime 15ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/dojo/dojox.socket.d.ts

https://github.com/vilic/DefinitelyTyped
TypeScript | 61 lines | 17 code | 2 blank | 42 comment | 0 complexity | cab0c4b324cc46f3100d2671b1bb06cf MD5 | raw file
 1// Type definitions for Dojo v1.9
 2// Project: http://dojotoolkit.org
 3// Definitions by: Michael Van Sickle <https://github.com/vansimke>
 4// Definitions: https://github.com/borisyankov/DefinitelyTyped
 5
 6declare module dojox {
 7    /**
 8     * Permalink: http://dojotoolkit.org/api/1.9/dojox/socket.html
 9     *
10     * Provides a simple socket connection using WebSocket, or alternate
11     * communication mechanisms in legacy browsers for comet-style communication. This is based
12     * on the WebSocket API and returns an object that implements the WebSocket interface:
13     * http://dev.w3.org/html5/websockets/#websocket
14     * Provides socket connections. This can be used with virtually any Comet protocol.
15     * 
16     * @param argsOrUrl This uses the same arguments as the other I/O functions in Dojo, or aURL to connect to. The URL should be a relative URL in order to properlywork with WebSockets (it can still be host relative, like //other-site.org/endpoint)     
17     */
18    interface socket{(argsOrUrl: Object): void}
19    module socket {
20        /**
21         * Provides a simple long-poll based comet-style socket/connection to a server and returns an
22         * object implementing the WebSocket interface:
23         * http://dev.w3.org/html5/websockets/#websocket
24         * 
25         * @param args This uses the same arguments as the other I/O functions in Dojo, with this addition:args.interval:Indicates the amount of time (in milliseconds) after a response was receivedbefore another request is made. By default, a request is made immediatelyafter getting a response. The interval can be increased to reduce load on theserver or to do simple time-based polling where the server always respondsimmediately.args.transport:Provide an alternate transport like dojo.io.script.get             
26         */
27        interface LongPoll{(args: Object): any}
28        /**
29         * 
30         * @param socket             
31         * @param newSocket             
32         * @param listenForOpen             
33         */
34        interface replace{(socket: any, newSocket: any, listenForOpen: any): void}
35        /**
36         * A wrapper for WebSocket, than handles standard args and relative URLs
37         * 
38         * @param args             
39         * @param fallback             
40         */
41        interface WebSocket{(args: any, fallback: any): void}
42        /**
43         * Permalink: http://dojotoolkit.org/api/1.9/dojox/socket/Reconnect.html
44         *
45         * Provides auto-reconnection to a websocket after it has been closed
46         * 
47         * @param socket Socket to add reconnection support to.     
48         * @param options     
49         */
50        interface Reconnect{(socket: any, options: any): void}
51    }
52}
53
54declare module "dojox/socket" {
55    var exp: dojox.socket
56    export=exp;
57}
58declare module "dojox/socket/Reconnect" {
59    var exp: dojox.socket.Reconnect
60    export=exp;
61}