Reputation: 276
I keep getting Failed to start the transport 'WebSockets': null when connecting to server.
I'm implementing a simple chat in reactnative mobile app. And I'm using @aspnet/signalr(version-1.1.4) library. I am getting this error - Error: Failed to start the transport 'WebSockets': null. See logs here
componentDidMount(){
try {
const connection = new signalR.HubConnectionBuilder() //Connect to a hub
.withUrl(baseUrl + `/chatbus`, {
transport: signalR.HttpTransportType.WebSockets | signalR.HttpTransportType.LongPolling,
'content-type': 'application/json',
accessTokenFactory: () => authToken //for authorization
})
.configureLogging(signalR.LogLevel.Debug)
.build();
connection.on('NotifySignalR', (ChatObject) => {
console.log(ChatObject);
});
connection.start()
.then(() => {
console.log('Chat Connection started.');
console.log('Now connected, connection ID=' + connection.id);
this.initalAttemptForChat = true;
connection.invoke("start");
})
.catch(() => {
this.initalAttemptForChat = false;
console.log('Error while establishing chatbus connection!');
});
} catch (e) {
console.log("error ", e);
throw e;
}
}
Upvotes: 10
Views: 22493
Reputation: 33
For anyone using Windows Server 2012, the steps are as follows (https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support):
To enable support for the WebSocket Protocol on Windows Server 2012, use the following steps:
Upvotes: 0
Reputation: 121
If you have you app in Windows Server just enable thw "WebSocket Protocol".
"Add or Remove Programs">"Turn Windows features on or off" > "Web Server(IIS)">"Web Server">"Application Development">"WebSocket Protocol".
Upvotes: 9