Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

broadcast-operator.d.ts 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. import type { BroadcastFlags, Room, SocketId } from "socket.io-adapter";
  2. import { Handshake } from "./socket";
  3. import type { Adapter } from "socket.io-adapter";
  4. import type { EventParams, EventNames, EventsMap, TypedEventBroadcaster } from "./typed-events";
  5. export declare class BroadcastOperator<EmitEvents extends EventsMap> implements TypedEventBroadcaster<EmitEvents> {
  6. private readonly adapter;
  7. private readonly rooms;
  8. private readonly exceptRooms;
  9. private readonly flags;
  10. constructor(adapter: Adapter, rooms?: Set<Room>, exceptRooms?: Set<Room>, flags?: BroadcastFlags);
  11. /**
  12. * Targets a room when emitting.
  13. *
  14. * @param room
  15. * @return a new BroadcastOperator instance
  16. * @public
  17. */
  18. to(room: Room | Room[]): BroadcastOperator<EmitEvents>;
  19. /**
  20. * Targets a room when emitting.
  21. *
  22. * @param room
  23. * @return a new BroadcastOperator instance
  24. * @public
  25. */
  26. in(room: Room | Room[]): BroadcastOperator<EmitEvents>;
  27. /**
  28. * Excludes a room when emitting.
  29. *
  30. * @param room
  31. * @return a new BroadcastOperator instance
  32. * @public
  33. */
  34. except(room: Room | Room[]): BroadcastOperator<EmitEvents>;
  35. /**
  36. * Sets the compress flag.
  37. *
  38. * @param compress - if `true`, compresses the sending data
  39. * @return a new BroadcastOperator instance
  40. * @public
  41. */
  42. compress(compress: boolean): BroadcastOperator<EmitEvents>;
  43. /**
  44. * Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
  45. * receive messages (because of network slowness or other issues, or because they’re connected through long polling
  46. * and is in the middle of a request-response cycle).
  47. *
  48. * @return a new BroadcastOperator instance
  49. * @public
  50. */
  51. get volatile(): BroadcastOperator<EmitEvents>;
  52. /**
  53. * Sets a modifier for a subsequent event emission that the event data will only be broadcast to the current node.
  54. *
  55. * @return a new BroadcastOperator instance
  56. * @public
  57. */
  58. get local(): BroadcastOperator<EmitEvents>;
  59. /**
  60. * Emits to all clients.
  61. *
  62. * @return Always true
  63. * @public
  64. */
  65. emit<Ev extends EventNames<EmitEvents>>(ev: Ev, ...args: EventParams<EmitEvents, Ev>): boolean;
  66. /**
  67. * Gets a list of clients.
  68. *
  69. * @public
  70. */
  71. allSockets(): Promise<Set<SocketId>>;
  72. /**
  73. * Returns the matching socket instances
  74. *
  75. * @public
  76. */
  77. fetchSockets(): Promise<RemoteSocket<EmitEvents>[]>;
  78. /**
  79. * Makes the matching socket instances join the specified rooms
  80. *
  81. * @param room
  82. * @public
  83. */
  84. socketsJoin(room: Room | Room[]): void;
  85. /**
  86. * Makes the matching socket instances leave the specified rooms
  87. *
  88. * @param room
  89. * @public
  90. */
  91. socketsLeave(room: Room | Room[]): void;
  92. /**
  93. * Makes the matching socket instances disconnect
  94. *
  95. * @param close - whether to close the underlying connection
  96. * @public
  97. */
  98. disconnectSockets(close?: boolean): void;
  99. }
  100. /**
  101. * Format of the data when the Socket instance exists on another Socket.IO server
  102. */
  103. interface SocketDetails {
  104. id: SocketId;
  105. handshake: Handshake;
  106. rooms: Room[];
  107. data: any;
  108. }
  109. /**
  110. * Expose of subset of the attributes and methods of the Socket class
  111. */
  112. export declare class RemoteSocket<EmitEvents extends EventsMap> implements TypedEventBroadcaster<EmitEvents> {
  113. readonly id: SocketId;
  114. readonly handshake: Handshake;
  115. readonly rooms: Set<Room>;
  116. readonly data: any;
  117. private readonly operator;
  118. constructor(adapter: Adapter, details: SocketDetails);
  119. emit<Ev extends EventNames<EmitEvents>>(ev: Ev, ...args: EventParams<EmitEvents, Ev>): boolean;
  120. /**
  121. * Joins a room.
  122. *
  123. * @param {String|Array} room - room or array of rooms
  124. * @public
  125. */
  126. join(room: Room | Room[]): void;
  127. /**
  128. * Leaves a room.
  129. *
  130. * @param {String} room
  131. * @public
  132. */
  133. leave(room: Room): void;
  134. /**
  135. * Disconnects this client.
  136. *
  137. * @param {Boolean} close - if `true`, closes the underlying connection
  138. * @return {Socket} self
  139. *
  140. * @public
  141. */
  142. disconnect(close?: boolean): this;
  143. }
  144. export {};