Skip to content

Commit

Permalink
fix: handle restart on socket error
Browse files Browse the repository at this point in the history
  • Loading branch information
xstelea committed May 24, 2023
1 parent a742862 commit fe811fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/connector/connector-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const ConnectorClient = (input: {
logger,
subjects: createSignalingSubjects(),
secrets,
restart: () => triggerRestartSubject.next(),
})

const webRtcClient = WebRtcClient({
Expand Down
2 changes: 2 additions & 0 deletions src/connector/signaling/signaling-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const SignalingClient = (input: {
target: MessageSources
source: MessageSources
logger?: Logger<unknown>
restart: () => void
}) => {
const logger = input.logger
const subjects = input.subjects
Expand Down Expand Up @@ -94,6 +95,7 @@ export const SignalingClient = (input: {
const onError = (event: Event) => {
logger?.debug(`🛰❌ signaling server error`, event)
subjects.onErrorSubject.next(event)
input.restart()
}

const prepareMessage = ({
Expand Down

0 comments on commit fe811fe

Please sign in to comment.