Skip to content

not connecting to self signed wss #136

@FTCHD

Description

@FTCHD

Having trouble using the client with wss on a server with a self signed certificate. The same connection works flawlessly in node.

Is a local certificate needed to use the library? Our purpose is to let anyone connect to their server which has self signed certificates (usually for docker management with portainer, which generates a selfsigned cert to use with the IP, not domain).

Code:

const { client: ws, created } = await getOrCreateWebSocketClient(
   `wss://xx.xxx.xxx.xxx:9443/api/websocket/exec?endpointId=2&id=${sessionId}`,
     {
           headers: { 'x-api-key': 'xxxxxxxxxx' },
           trustSelfSignedServerCertificate: true,
     }
)


ws.onOpen = () => {
   console.log('WebSocket connected')
}

await ws.open()

More Info:

  • created is true
  • await ws.open() does not error
  • ws.onOpen() never gets triggered

Additionally, this appears in the logs which made me think if a certificate is required:

Mattermost: Error loading pinned certificates -- Error Domain=NSCocoaErrorDomain Code=260 "The file
“certs” couldn’t be opened because there is no such file."
UserInfo={NSURL=file:///Users/xxx/Library/Developer/CoreSimulator/Devices/UUID/data/Containers/Bundle/Application/UUID/pourtainer.app/certs,
NSFilePath=/Users/xxx/Library/Developer/CoreSimulator/Devices/UUID/data/Containers/Bundle/Application/UUID/pourtainer.app/certs,

Versions:

  • expo 52
  • rn 76
  • network-client 1.7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions