Skip to content

connection can be either Connection or ConnectionConfiguration #606

Open
@canadaduane

Description

@canadaduane

The problem I am facing
It's a bit confusing that there is a connection key in various hook payloads that is either a Connection instance or a ConnectionConfiguration object. Both are quite different:

Connection

  webSocket: WebSocket
  context: any
  document: Document
  pingInterval: NodeJS.Timeout
  pongReceived = true
  request: HTTPIncomingMessage
  timeout: number
  callbacks: any
  socketId: string
  lock: AsyncLock
  readOnly: Boolean
  logger: Debugger

ConnectionConfiguration

  readOnly: boolean
  requiresAuthentication: boolean
  isAuthenticated: boolean

But they appear to be the same at first glance:

onConnect({connection}) {
  // connection is ConnectionConfiguration
})

beforeHandleMessage({connection}) {
  // connection is Connection
})

The solution I would like
It would be great if ConnectionConfiguration were always connectionConfig and Connection were always connection.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions