mattermost / mattermost/react-native-network-client
not connecting to self signed `wss`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 48
- Forks
- 26
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 2
Description
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:
createdis trueawait ws.open()does not errorws.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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the Expo/RN 76 connection against a self-signed wss server with trustSelfSignedServerCertificate enabled, then trace the network-client 1.7.3 WebSocket open path and the pinned-certificate loading log. Done means the connection reaches onOpen or reports a clear certificate-related error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile-dev, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100