nsIWebSocketEventService.idl 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "domstubs.idl"
  6. #include "nsISupports.idl"
  7. [scriptable, builtinclass, uuid(6714a6be-2265-4f73-a988-d78a12416037)]
  8. interface nsIWebSocketFrame : nsISupports
  9. {
  10. readonly attribute DOMHighResTimeStamp timeStamp;
  11. readonly attribute boolean finBit;
  12. readonly attribute boolean rsvBit1;
  13. readonly attribute boolean rsvBit2;
  14. readonly attribute boolean rsvBit3;
  15. readonly attribute unsigned short opCode;
  16. readonly attribute boolean maskBit;
  17. readonly attribute unsigned long mask;
  18. readonly attribute ACString payload;
  19. // Non-Control opCode values:
  20. const unsigned short OPCODE_CONTINUATION = 0x0;
  21. const unsigned short OPCODE_TEXT = 0x1;
  22. const unsigned short OPCODE_BINARY = 0x2;
  23. // Control opCode values:
  24. const unsigned short OPCODE_CLOSE = 0x8;
  25. const unsigned short OPCODE_PING = 0x9;
  26. const unsigned short OPCODE_PONG = 0xA;
  27. };
  28. [scriptable, uuid(e7c005ab-e694-489b-b741-96db43ffb16f)]
  29. interface nsIWebSocketEventListener : nsISupports
  30. {
  31. void webSocketCreated(in unsigned long aWebSocketSerialID,
  32. in AString aURI,
  33. in ACString aProtocols);
  34. void webSocketOpened(in unsigned long aWebSocketSerialID,
  35. in AString aEffectiveURI,
  36. in ACString aProtocols,
  37. in ACString aExtensions);
  38. const unsigned short TYPE_STRING = 0x0;
  39. const unsigned short TYPE_BLOB = 0x1;
  40. const unsigned short TYPE_ARRAYBUFFER = 0x2;
  41. void webSocketMessageAvailable(in unsigned long aWebSocketSerialID,
  42. in ACString aMessage,
  43. in unsigned short aType);
  44. void webSocketClosed(in unsigned long aWebSocketSerialID,
  45. in boolean aWasClean,
  46. in unsigned short aCode,
  47. in AString aReason);
  48. void frameReceived(in unsigned long aWebSocketSerialID,
  49. in nsIWebSocketFrame aFrame);
  50. void frameSent(in unsigned long aWebSocketSerialID,
  51. in nsIWebSocketFrame aFrame);
  52. };
  53. [scriptable, builtinclass, uuid(b89d1b90-2cf3-4d8f-ac21-5aedfb25c760)]
  54. interface nsIWebSocketEventService : nsISupports
  55. {
  56. void addListener(in unsigned long long aInnerWindowID,
  57. in nsIWebSocketEventListener aListener);
  58. void removeListener(in unsigned long long aInnerWindowID,
  59. in nsIWebSocketEventListener aListener);
  60. };