Skip to content

Commit

Permalink
chore: reduce heartbeat logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cameri committed Nov 7, 2022
1 parent 45774d7 commit 240f611
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/adapters/web-server-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class WebServerAdapter extends EventEmitter implements IWebServerAdapter
}

private onRequest(request: IncomingMessage, response: ServerResponse) {
debug('request received: %o', request)
debug('request received: %O', request.rawHeaders)
if (request.method === 'GET' && request.headers['accept'] === 'application/nostr+json') {
const {
info: { name, description, pubkey, contact },
Expand All @@ -56,7 +56,6 @@ export class WebServerAdapter extends EventEmitter implements IWebServerAdapter
response.setHeader('content-type', 'application/text')
response.end('Please use a Nostr client to connect.')
}
debug('send response: %o', response)
}

private onError(error: Error, socket: Duplex) {
Expand Down
5 changes: 3 additions & 2 deletions src/adapters/web-socket-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { isEventMatchingFilter } from '../utils/event'
import { messageSchema } from '../schemas/message-schema'

const debug = createLogger('web-socket-adapter')
const debugHeartbeat = debug.extend('heartbeat')

export class WebSocketAdapter extends EventEmitter implements IWebSocketAdapter {
public clientId: string
Expand Down Expand Up @@ -103,7 +104,7 @@ export class WebSocketAdapter extends EventEmitter implements IWebSocketAdapter

this.alive = false
this.client.ping()
debug('client %s ping', this.clientId)
debugHeartbeat('client %s ping', this.clientId)
}

public getSubscriptions(): Map<string, SubscriptionFilter[]> {
Expand Down Expand Up @@ -145,7 +146,7 @@ export class WebSocketAdapter extends EventEmitter implements IWebSocketAdapter
}

private onClientPong() {
debug('client %s pong', this.clientId)
debugHeartbeat('client %s pong', this.clientId)
this.alive = true
}

Expand Down

0 comments on commit 240f611

Please sign in to comment.