PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/typings/socket.io/socket.io.d.ts

https://github.com/tumada/test02
TypeScript Typings | 70 lines | 54 code | 11 blank | 5 comment | 0 complexity | 91a1c74e276dfe7b5c57879deb1b3731 MD5 | raw file
Possible License(s): JSON, BSD-2-Clause, BSD-3-Clause, Apache-2.0, MIT, 0BSD
  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. ///<reference path='../node/node.d.ts' />
  6. declare module "socket.io" {
  7. import http = require('http');
  8. export function listen(server: http.Server, options: any, fn: Function): SocketManager;
  9. export function listen(server: http.Server, fn?: Function): SocketManager;
  10. export function listen(port: Number): SocketManager;
  11. interface Socket {
  12. id: string;
  13. json:any;
  14. log: any;
  15. volatile: any;
  16. broadcast: any;
  17. handshake: any;
  18. in(room: string): Socket;
  19. to(room: string): Socket;
  20. join(name: string, fn: Function): Socket;
  21. leave(name: string, fn: Function): Socket;
  22. set(key: string, value: any, fn: Function): Socket;
  23. get(key: string, fn: Function): Socket;
  24. has(key: string, fn: Function): Socket;
  25. del(key: string, fn: Function): Socket;
  26. disconnect(): Socket;
  27. send(data: any, fn: Function): Socket;
  28. emit(ev: any, ...data:any[]): Socket;
  29. on(ns: string, fn: Function): Socket;
  30. }
  31. interface SocketNamespace {
  32. clients(room: string): Socket[];
  33. log: any;
  34. store: any;
  35. json: any;
  36. volatile: any;
  37. in(room: string): SocketNamespace;
  38. on(evt: string, fn: (socket: Socket) => void): SocketNamespace;
  39. to(room: string): SocketNamespace;
  40. except(id: any): SocketNamespace;
  41. send(data: any): any;
  42. emit(ev: any, ...data:any[]): Socket;
  43. socket(sid: any, readable: boolean): Socket;
  44. authorization(fn: Function): SocketNamespace;
  45. }
  46. interface SocketManager {
  47. get(key: any): any;
  48. set(key: any, value: any): SocketManager;
  49. enable(key: any): SocketManager;
  50. disable(key: any): SocketManager;
  51. enabled(key: any): boolean;
  52. disabled(key: any): boolean;
  53. configure(env: string, fn: Function): SocketManager;
  54. configure(fn: Function): SocketManager;
  55. of(nsp: string): SocketNamespace;
  56. on(ns: string, fn: Function): SocketManager;
  57. sockets: SocketNamespace;
  58. }
  59. }