-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Socket hung up error on react native android #82
Comments
@cogmeta Did you manage to find the solution? |
@jondubois Yes, Thank you. There were lots of things to fix (protocol option in socketOption, uws engine on server side, nginx settings). I will write a checklist that might benefit others as well while troubleshooting. |
Hi @cogmeta And from client side But it throws following error And is it, I have to connect to the server using http first then i have to fire |
Use secure: true during making connection with server.
…On Feb 6, 2018 12:56 PM, "Louies89" ***@***.***> wrote:
Hi @cogmeta <https://github.com/cogmeta>
I am trying to connect to socketcluster server using react native. I am
using below scWorker code to connect:
class Worker extends SCWorker {
run() {
var httpServer = this.httpServer;
var scServer = this.scServer;
scServer.on('connection', function (socket) {
console.log('client :'+ socket.id + ' connected.');
})
}
}
And from client side
var Newsocket = socketCluster.connect({
hostname: 'localhost',
port: 80})
But it throws following error
Can anyone help me out please? And is it, I have to connect to the server
using http first then i have to fire
var Newsocket = socketCluster.connect({
hostname: 'localhost',
port: 80})
from client side?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AP8vSSqPE54XseoDj5eEI09QBws1KFKRks5tR_6kgaJpZM4N9LO6>
.
|
I know this has been posted multiple times and it is always some simple configuration mistake or version mismatch but no matter what we try, we cant seem to get rid of this error "SocketProtocolError", message: "Socket hung up". The server and client works fine with web browsers Chrome and Firefox but not with react native. Can someone help? Thanks in advance.
socketcluster-server@5.14.0
socketcluster-client@5.5.1
import socketCluster from 'socketcluster-client';
const socketOptions = {
hostname: 'xxx.xxxx.xxx',
secure : true,
port: 443
};
this.chatsocket = socketCluster.connect(socketOptions);
this.chatsocket.on('connect', this.onSocketConnect.bind(this));
this.chatsocket.on('proxyReply', this.onSocketMessage.bind(this));
this.chatsocket.on('error', this.onSocketError.bind(this));
SocketProtocolError {name: "SocketProtocolError", message: "Socket hung up", code: 1006, stack: "SocketProtocolError: Socket hung up↵ at SCSocke…m=android&dev=true&hot=true&minify=false:8669:42)"}
The text was updated successfully, but these errors were encountered: