enums.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. export enum ConnectionType {
  2. Data = "data",
  3. Media = "media",
  4. }
  5. export enum PeerErrorType {
  6. /**
  7. * The client's browser does not support some or all WebRTC features that you are trying to use.
  8. */
  9. BrowserIncompatible = "browser-incompatible",
  10. /**
  11. * You've already disconnected this peer from the server and can no longer make any new connections on it.
  12. */
  13. Disconnected = "disconnected",
  14. /**
  15. * The ID passed into the Peer constructor contains illegal characters.
  16. */
  17. InvalidID = "invalid-id",
  18. /**
  19. * The API key passed into the Peer constructor contains illegal characters or is not in the system (cloud server only).
  20. */
  21. InvalidKey = "invalid-key",
  22. /**
  23. * Lost or cannot establish a connection to the signalling server.
  24. */
  25. Network = "network",
  26. /**
  27. * The peer you're trying to connect to does not exist.
  28. */
  29. PeerUnavailable = "peer-unavailable",
  30. /**
  31. * PeerJS is being used securely, but the cloud server does not support SSL. Use a custom PeerServer.
  32. */
  33. SslUnavailable = "ssl-unavailable",
  34. /**
  35. * Unable to reach the server.
  36. */
  37. ServerError = "server-error",
  38. /**
  39. * An error from the underlying socket.
  40. */
  41. SocketError = "socket-error",
  42. /**
  43. * The underlying socket closed unexpectedly.
  44. */
  45. SocketClosed = "socket-closed",
  46. /**
  47. * The ID passed into the Peer constructor is already taken.
  48. *
  49. * :::caution
  50. * This error is not fatal if your peer has open peer-to-peer connections.
  51. * This can happen if you attempt to {@apilink Peer.reconnect} a peer that has been disconnected from the server,
  52. * but its old ID has now been taken.
  53. * :::
  54. */
  55. UnavailableID = "unavailable-id",
  56. /**
  57. * Native WebRTC errors.
  58. */
  59. WebRTC = "webrtc",
  60. }
  61. export enum SerializationType {
  62. Binary = "binary",
  63. BinaryUTF8 = "binary-utf8",
  64. JSON = "json",
  65. None = "raw",
  66. }
  67. export enum SocketEventType {
  68. Message = "message",
  69. Disconnected = "disconnected",
  70. Error = "error",
  71. Close = "close",
  72. }
  73. export enum ServerMessageType {
  74. Heartbeat = "HEARTBEAT",
  75. Candidate = "CANDIDATE",
  76. Offer = "OFFER",
  77. Answer = "ANSWER",
  78. Open = "OPEN", // The connection to the server is open.
  79. Error = "ERROR", // Server error.
  80. IdTaken = "ID-TAKEN", // The selected ID is taken.
  81. InvalidKey = "INVALID-KEY", // The given API key cannot be found.
  82. Leave = "LEAVE", // Another peer has closed its connection to this peer.
  83. Expire = "EXPIRE", // The offer sent to a peer has expired without response.
  84. }