In Android mobile with the react-native framework, the socket is closed on every 4 ~ 5 mins with onError
Log:
I/ReactNativeJS: 'State changed to onerror - Remote party', { type: 'error',
target:
{ CONNECTING: 0,
OPEN: 1,
CLOSING: 2,
CLOSED: 3,
readyState: 3,
_eventEmitter:
{ _subscriber:
{ _subscriptionsForType:
{ appStateDidChange:
[ { subscriber: [Circular],
emitter:
{ _subscriber: [Circular],
isAvailable: true,
_eventHandlers:
{ change:
{ _mapData: [ [Object], [Object], [Object], [Object] ],
_objectIndex: { '2': 0, '4': 1, '7': 2, '11': 3 },
_stringIndex: {},
_otherIndex: {} },
memoryWarning:
{ _mapData: [],
_objectIndex: {},
_stringIndex: {},
_otherIndex: {} } },
currentState: 'active' },
listener: [Function],
context: undefined,
eventType: 'appStateDidChange',
key: 0 },
{ subscriber: [Circular],
emitter:
{ _subscriber: [Circular],
isAvailable: true,
_eventHandlers:
{ change:
{ _mapData: [ [Object], [Object], [Object], [Object] ],
_objectIndex: { '2': 0, '4': 1, '7': 2, '11': 3 },
_stringIndex: {},
_otherIndex: {} },
memoryWarning:
{ _mapData: [],
_objectIndex: {},
_stringIndex: {},
_otherIndex: {} } },
currentState: 'active' },
listener: [Function],
context: undefined,
eventType: 'appStateDidChange',
key: 1 },
{ subscriber: [Circular],
emitter:
{ _subscriber: [Circular],
isAvailable: true,
_eventHandlers:
{ change:
{ _mapData: [ [Object], [Object], [Object], [Object] ],
_objectIndex: { '2': 0, '4': 1, '7': 2, '11': 3 },
_stringIndex: {},
_otherIndex: {} },
memoryWarning:
{ _mapData: [],
_objectIndex: {},
_stringIndex: {},
_otherIndex: {} } },
currentState: 'active' },
listener: [Function],
context: undefined,
eventType: 'appStateDidChange',
key: 2 },
{ subscriber: [Circular],
emitter:
{ _subscriber: [Circular],
isAvailable: true,
_eventHandlers:
{ change:
{ _mapData: [ [Object], [Object], [Object], [Object] ],
_objectIndex: { '2': 0, '4': 1, '7': 2, '11': 3 },
_stringIndex: {},
_otherIndex: {} },
memoryWarning:
{ _mapData: [],
_objectIndex: {},
_stringIndex: {},
_otherIndex: {} } },
currentState: 'active' },
listener: [Function],
context: undefined,
eventType: 'appStateDidChange',
key: 3 },
{ subscriber: [Circular],
emitter:
{ _subscriber:
I/ReactNativeJS: Thu Nov 1 18:01:17 2018, "Generic Console", "takeOverConsole", [{"0":"State changed to onclose - Remote party"}]
I/ReactNativeJS: State changed to onclose - Remote party
+1 @schavaLogi Did you find any solution?
@perrosnk lol this is painful. I think its React-Native, its closing the socket connection. The keepAlive gets interrupted if the socket disconnects. I'm gonna try replicate on the web and try on a fresh React-Native project
+1 @schavaLogi Did you find any solution?
I am waiting for community help as it is purely mobile platform specific disconnect
@schavaLogi What was the solution to the other 2 (issues) issue issue you have closed?
Could these two be related?
There also seems to be another open issue that could be related.
I believe we should make a guide with best practices and guidance on how to use this library with react native
I mentioned the reason and solution in those specific issues. we adjusted timeout and keepalive interval in our servers.
+1 @schavaLogi Did you find any solution?
I am waiting for community help as it is purely mobile platform specific disconnect
Well it happens on iOS as well!
I am experiencing this on iOS as well. Any info would be great!
This issue is not happening on my local machine. Only when the updates are done on a Digital Ocean Ubuntu server. Do the Keep Alive settings need to change on the server?
thats interesting @forbesgillikin, i get the same issue on local and remote
Wee also seem to be experiencing a similar issue. I think diagnostics of these would be easier if #505 was addressed first, so users are allowed to log the reason for disconnetions (and maybe learn which party is disconnecting the socket and, possibly, that the issue is with their setup).
Did someone find out a Solution for this?
Most helpful comment
I mentioned the reason and solution in those specific issues. we adjusted timeout and keepalive interval in our servers.