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

/socket.io/legacy/socket.io-0.9.d.ts

https://github.com/vilic/DefinitelyTyped
TypeScript | 70 lines | 54 code | 11 blank | 5 comment | 0 complexity | 41e0b4ef6fafb64f2c4f6773b2f3d616 MD5 | raw file
 1// Type definitions for socket.io
 2// Project: http://socket.io/
 3// Definitions by: William Orr <https://github.com/worr>
 4// Definitions: https://github.com/borisyankov/DefinitelyTyped
 5
 6
 7///<reference path='../../node/node.d.ts' />
 8
 9declare module "socket.io-0.9" {
10	import http = require('http');
11
12	export function listen(server: http.Server, options: any, fn: Function): SocketManager;
13	export function listen(server: http.Server, fn?: Function): SocketManager;
14	export function listen(port: Number): SocketManager;
15
16
17  interface Socket {
18    id: string;
19    json:any;
20    log: any;
21    volatile: any;
22    broadcast: any;
23    handshake: any;
24    in(room: string): Socket;
25    to(room: string): Socket;
26    join(name: string, fn: Function): Socket;
27    leave(name: string, fn: Function): Socket;
28    set(key: string, value: any, fn: Function): Socket;
29    get(key: string, fn: Function): Socket;
30    has(key: string, fn: Function): Socket;
31    del(key: string, fn: Function): Socket;
32    disconnect(): Socket;
33    send(data: any, fn: Function): Socket;
34    emit(ev: any, ...data:any[]): Socket;
35    on(ns: string, fn: Function): Socket;
36  }
37
38  interface SocketNamespace {
39    clients(room: string): Socket[];
40    log: any;
41    store: any;
42    json: any;
43    volatile: any;
44    in(room: string): SocketNamespace;
45    on(evt: string, fn: (socket: Socket) => void): SocketNamespace;
46    to(room: string): SocketNamespace;
47    except(id: any): SocketNamespace;
48    send(data: any): any;
49    emit(ev: any, ...data:any[]): Socket;
50    socket(sid: any, readable: boolean): Socket;
51    authorization(fn: Function): SocketNamespace;
52  }
53
54  interface SocketManager {
55    get(key: any): any;
56    set(key: any, value: any): SocketManager;
57    enable(key: any): SocketManager;
58    disable(key: any): SocketManager;
59    enabled(key: any): boolean;
60    disabled(key: any): boolean;
61    configure(env: string, fn: Function): SocketManager;
62    configure(fn: Function): SocketManager;
63    of(nsp: string): SocketNamespace;
64    on(ns: string, fn: Function): SocketManager;
65    sockets: SocketNamespace;
66  }
67
68
69}
70