Skip to content

Commit

Permalink
Rename subscribeToEventType to listen
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsh committed Jun 5, 2023
1 parent 8b09c69 commit 1fe9eae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class ClientConnectionWatcherComponent extends ComponentStore<ClientConne
private readonly watchClientConnections = this.effect((trigger$) =>
trigger$.pipe(
switchMap(() =>
this.socket.subscribeToEventType<SubscriptionEvent>(['connect', 'disconnect']).pipe(
this.socket.listen<SubscriptionEvent>(['connect', 'disconnect']).pipe(
withLatestFrom(this.connectionMessages$),
tap(([event, connectionMessages]) => {
const connectionMessage = `Client ${
Expand Down
2 changes: 1 addition & 1 deletion libs/main-ui/src/lib/messenger.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class MessengerComponent extends ComponentStore<MessengerState> {
readonly listenForMessages = this.effect((trigger$) =>
trigger$.pipe(
switchMap(() =>
this.socketService.subscribeToEventType<SubscriptionEvent<Message>>('message').pipe(
this.socketService.listen<SubscriptionEvent<Message>>('message').pipe(
withLatestFrom(this.messages$),
tap(([message, messages]) => {
this.patchState({ messages: [...messages, message.body].slice(-MAX_MESSAGES) });
Expand Down
4 changes: 2 additions & 2 deletions libs/web-sockets/src/lib/socket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class SocketService extends ComponentStore<SocketState> {
}

/**
* Begins subscribing to a type of events or events.
* Begins listening to a type of events or events.
*
* Sets up the subscription with the server, sending a subscribe message, and returning a stream
* of filtered messages.
Expand All @@ -266,7 +266,7 @@ export class SocketService extends ComponentStore<SocketState> {
* @param eventType
* @returns A stream of messages of the specified type.
*/
subscribeToEventType<T extends SubscriptionEvent>(eventType: EventType | EventType[]): Observable<T> {
listen<T extends SubscriptionEvent>(eventType: EventType | EventType[]): Observable<T> {
// Send a message to the server to begin subscribe to each of the event types we're
// first to subscribe to.
this.subscribeIfFirst(eventType);
Expand Down

0 comments on commit 1fe9eae

Please sign in to comment.