Unable to connect socket.io server | iOS client - node.js

I'm not able to connect the ios client app to the server.
Android is working fine.
Following socket client version i'm using.
We tried the following links:
https://socket.io/docs/v4/troubleshooting-connection-issues/
https://github.com/socketio/socket.io/issues/3794
Socket Server Version(node):
"socket.io": "^4.5.2"
iOS: Socket Client Version
pod 'Socket.IO-Client-Swift','16.0.0'
Android: Socket Client Version
'io.socket:socket.io-client:2.0.1'
Here is the error log.
2022-11-09 15:36:13.806244+0530 Chat[11058:250537] LOG SocketManager: Manager is being released
2022-11-09 15:36:13.809821+0530 Chat[11058:250537] LOG SocketIOClient{/}: Handling event: statusChange with data: [connecting, 2]
2022-11-09 15:36:13.810822+0530 Chat[11058:250537] LOG SocketIOClient{/}: Joining namespace /
2022-11-09 15:36:13.811809+0530 Chat[11058:250537] LOG SocketManager: Tried connecting socket when engine isn't open. Connecting
2022-11-09 15:36:13.812649+0530 Chat[11058:250537] LOG SocketManager: Adding engine
2022-11-09 15:36:13.816521+0530 Chat[11058:250965] LOG SocketEngine: Starting engine. Server: https://socketserver.com/
2022-11-09 15:36:13.817360+0530 Chat[11058:250965] LOG SocketEngine: Handshaking
2022-11-09 15:36:13.891828+0530 Chat[11058:250537] [UICollectionViewRecursion] cv == 0x7fc7f28afe00 Disabling recursion trigger logging
2022-11-09 15:36:14.011073+0530 Chat[11058:250979] [boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics
2022-11-09 15:36:14.031883+0530 Chat[11058:250936] LOG SocketEngine: Got message: 0{"sid":"MZvaOLNP7rHRyHPmAACE","upgrades":[],"pingInterval":25000,"pingTimeout":20000,"maxPayload":1000000}
2022-11-09 15:36:14.066076+0530 Chat[11058:250537] LOG SocketIOClient{/}: Handling event: websocketUpgrade with data: [["Connection": "upgrade", "Sec-WebSocket-Accept": "7Pq2JXa4nY+2HM4/iTfQnlr36zI=", "Server": "nginx/1.20.1", "Upgrade": "websocket", "Date": "Wed, 09 Nov 2022 10:06:14 GMT"]]
SocketAnyEvent: Event: websocketUpgrade items: Optional([["Connection": "upgrade", "Sec-WebSocket-Accept": "7Pq2JXa4nY+2HM4/iTfQnlr36zI=", "Server": "nginx/1.20.1", "Upgrade": "websocket", "Date": "Wed, 09 Nov 2022 10:06:14 GMT"]])
2022-11-09 15:36:14.068315+0530 Chat[11058:250537] LOG SocketManager: Engine opened Connect
2022-11-09 15:36:14.069540+0530 Chat[11058:250936] LOG SocketEngine: Writing ws: 0/, has data: false
2022-11-09 15:36:14.070357+0530 Chat[11058:250936] LOG SocketEngineWebSocket: Sending ws: 0/, as type: 4
2022-11-09 15:36:14.092916+0530 Chat[11058:250936] LOG SocketEngine: Got message: 44{"message":"invalid"}
2022-11-09 15:36:14.094201+0530 Chat[11058:250537] LOG SocketParser: Parsing 4{"message":"invalid"}
2022-11-09 15:36:14.098295+0530 Chat[11058:250537] LOG SocketParser: Decoded packet as: SocketPacket {type: 4; data: [{
message = invalid;
}]; id: -1; placeholders: -1; nsp: /}
2022-11-09 15:36:14.099612+0530 Chat[11058:250537] LOG SocketIOClient{/}: Handling event: error with data: [{
message = invalid;
}]
SocketAnyEvent: Event: error items: Optional([{
message = invalid;
}])
2022-11-09 15:36:39.094504+0530 Chat[11058:250935] LOG SocketEngine: Got message: 2
2022-11-09 15:36:39.094918+0530 Chat[11058:250935] LOG SocketEngine: Writing ws: has data: false
2022-11-09 15:36:39.094992+0530 Chat[11058:250537] LOG SocketIOClient{/}: Handling event: ping with data: []
SocketAnyEvent: Event: ping items: Optional([])
2022-11-09 15:36:39.095224+0530 Chat[11058:250935] LOG SocketEngineWebSocket: Sending ws: as type: 3

Related

ngx-socket-io connected false but flask_socketio logs show 200 OK

Any tips to debug would help, this is just the basic implementation.
I am using the exact tutorial as here to setup the ngx socket client:
https://www.npmjs.com/package/ngx-socket-io
flask-socketio for the server
https://flask-socketio.readthedocs.io/en/latest/
Server-side shows no error, but the registered handler methods to emit/receive seem blind.
Server Logs:
127.0.0.1 - - [28/Jan/2021 10:58:51] "GET /socket.io/?EIO=3&transport=polling&t=NT8Dtbg HTTP/1.1" 200 418 0.000640
(12285) accepted ('127.0.0.1', 37400)
fa1a1d40bbc349c384a121302ef567c7: Received request to upgrade to websocket
127.0.0.1 - - [28/Jan/2021 10:58:51] "GET /socket.io/?EIO=3&transport=polling&t=NT8Dtcd&sid=fa1a1d40bbc349c384a121302ef567c7 HTTP/1.1" 200 235 0.000408
127.0.0.1 - - [28/Jan/2021 10:58:51] "GET /socket.io/?EIO=3&transport=polling&t=NT8DtdE&sid=fa1a1d40bbc349c384a121302ef567c7 HTTP/1.1" 200 235 0.000268
fa1a1d40bbc349c384a121302ef567c7: Upgrade to websocket successful
5002732d42184ba6b453e7d4f35e864e: Received packet PING data None
5002732d42184ba6b453e7d4f35e864e: Sending packet PONG data None
Client logs:
config: {url: "http://127.0.0.1:5000/", options: {…}}
emptyConfig: {url: "", options: {…}}
eventObservables$: {}
ioSocket: Socket
acks: {}
connected: false
disconnected: true
flags: {}
ids: 0
io: Manager
autoConnect: true
backoff: Backoff {ms: 1000, max: 5000, factor: 2, jitter: 0.5, attempts: 0}
connecting: [Socket]
decoder: Decoder {reconstructor: null, _callbacks: {…}}
encoder: Encoder {}
encoding: false
engine: Socket {secure: false, agent: false, hostname: "127.0.0.1", port: "5000", query: {…}, …}
lastPing: Thu Jan 28 2021 11:00:56
Server code (no print)
#socketio.on('connect')
def test_connect():
print('\n\nClient connected')
Why can't I get the connection working? Thanks
Double check npm/python environment of current versions of socketio and engineio.
https://github.com/miguelgrinberg/python-socketio
d7e95928d73c42fab431e94ce2df40fc: Sending packet OPEN data {'sid': 'd7e95928d73c42fab431e94ce2df40fc', 'upgrades': ['websocket'], 'pingTimeout': 60000, 'pingInterval': 25000}
Client connected
d7e95928d73c42fab431e94ce2df40fc: Sending packet MESSAGE data 0

Node rdkafka consumer stops fetching messages

Consumer stops fetching after getting following error
{ Error: Local: Broker transport failure at Error (native) origin: 'local', message: 'broker transport failure', code: -1, errno: -1, stack: 'Error: Local: Broker transport failure\n at Error (native)' }
All kafka servers are healthy even then I am getting the transport failure .
After this error consumers stops fetching further messages

Cassandra HeartBeat logs

I am using cassandra in my spring application. Everytime a request comes or connection is idle, cassandra is printing heartbeat DEBUG logs through logback of my application. I want to stop these heartbeat logs in my debug logs.
2016-11-03 11:37:27,241 DEBUG [cluster1-nio-worker-2] [com.datastax.driver.core.Connection] [line : 1093 ] [] - Connection[/10.41.123.31:9042-2, inFlight=0, closed=false] heartbeat query succeeded
2016-11-03 11:37:30,990 DEBUG [cluster1-nio-worker-6] [com.datastax.driver.core.Connection] [line : 1023 ] [] - Connection[/10.41.123.31:9042-6, inFlight=0, closed=false] was inactive for 30 seconds, sending heartbeat
2016-11-03 11:37:30,991 DEBUG [cluster1-nio-worker-1] [com.datastax.driver.core.Connection] [line : 1023 ] [] - Connection[/10.41.123.31:9042-1, inFlight=0, closed=false] was inactive for 30 seconds, sending heartbeat
2016-11-03 11:37:30,990 DEBUG [cluster1-nio-worker-5] [com.datastax.driver.core.Connection] [line : 1023 ] [] - Connection[/10.41.123.31:9042-5, inFlight=0, closed=false] was inactive for 30 seconds, sending heartbeat
2016-11-03 11:37:30,990 DEBUG [cluster1-nio-worker-7] [com.datastax.driver.core.Connection] [line : 1023 ] [] - Connection[/10.41.123.31:9042-7, inFlight=0, closed=false] was inactive for 30 seconds, sending heartbeat
2016-11-03 11:37:30,993 DEBUG [cluster1-nio-worker-5] [com.datastax.driver.core.Connection] [line : 1093 ] [] - Connection[/10.41.123.31:9042-5, inFlight=0, closed=false] heartbeat query succeeded
2016-1
What logger are you using?
If you are using log4j you can configure the debug level like this:
import org.apache.log4j.PropertyConfigurator;
private static final org.slf4j.Logger log = LoggerFactory.getLogger(Application.class);
public Application() {
final Properties properties = new Properties();
properties.put("log4j.rootLogger", "INFO, A1");
PropertyConfigurator.configure(properties);
}
Then the heartbeats should not longer be printed out.

Cant connect to scassandra (stubbed cassandra) using datastax-driver

I have troubles connecting to cassandra.
Im trying to connect to s-cassandra (which is a stubbed cassandra as can be reviewed here), with a datastax node.js cassandra driver.
For some reason passing "127.0.0.1:8042" as a contact point to the driver
results in a DriverInternalError:( tough sometimes it does work randomly and I havent still figured out why sometimes it does and sometime i doesnt..)
The DriverInternalError I get:
{"name": "DriverInternalError",
"stack": "...",
"message": "Local datacenter could not be
determined",
"info": "Represents a bug inside the driver or in a
Cassandra host." }
That is what I see from Cassandra Driver's log:
log event: info -- Adding host 127.0.0.1:8042
log event: info -- Getting first connection
log event: info -- Connecting to 127.0.0.1:8042
log event: verbose -- Socket connected to 127.0.0.1:8042
log event: info -- Trying to use protocol version 4
log event: verbose -- Sending stream #0
log event: verbose -- Sent stream #0 to 127.0.0.1:8042
{"name":"application-storage","hostname":"Yuris-MacBook-Pro.local","pid":1338,"level":30,"msg":"Kafka producer is initialized","time":"2016-08-05T12:53:53.124Z","v":0}
log event: verbose -- Received frame #0 from 127.0.0.1:8042
log event: info -- Protocol v4 not supported, using v2
log event: verbose -- Done receiving frame #0
log event: verbose -- disconnecting
log event: info -- Connection to 127.0.0.1:8042 closed
log event: info -- Connecting to 127.0.0.1:8042
log event: verbose -- Socket connected to 127.0.0.1:8042
log event: info -- Trying to use protocol version 2
log event: verbose -- Sending stream #0
log event: verbose -- Sent stream #0 to 127.0.0.1:8042
log event: verbose -- Received frame #0 from 127.0.0.1:8042
log event: info -- Connection to 127.0.0.1:8042 opened successfully
log event: info -- Connection pool to host 127.0.0.1:8042 created with 1 connection(s)
log event: info -- Control connection using protocol version 2
log event: info -- Connection acquired to 127.0.0.1:8042, refreshing nodes list
log event: info -- Refreshing local and peers info
log event: verbose -- Sending stream #1
log event: verbose -- Done receiving frame #0
log event: verbose -- Sent stream #1 to 127.0.0.1:8042
log event: verbose -- Received frame #1 from 127.0.0.1:8042
log event: warning -- No local info provided
log event: verbose -- Sending stream #0
log event: verbose -- Done receiving frame #1
log event: verbose -- Sent stream #0 to 127.0.0.1:8042
log event: verbose -- Received frame #0 from 127.0.0.1:8042
log event: info -- Peers info retrieved
log event: error -- Tokenizer could not be determined
log event: info -- Retrieving keyspaces metadata
log event: verbose -- Sending stream #1
log event: verbose -- Done receiving frame #0
log event: verbose -- Sent stream #1 to 127.0.0.1:8042
log event: verbose -- Received frame #1 from 127.0.0.1:8042
log event: verbose -- Sending stream #0
log event: verbose -- Done receiving frame #1
log event: verbose -- Sent stream #0 to 127.0.0.1:8042
log event: verbose -- Received frame #0 from 127.0.0.1:8042
log event: info -- ControlConnection connected to 127.0.0.1:8042 and is up to date
Ive tried playing with the firewall and open application but help is not there.. tough sometimes it does work randomly and I havent still figured out why..
I have a mac OS X El Capitan
The Solution that helped me:
I needed to prime the system.local table as a prime-query-single
{
query: 'prime-query-single',
header: {'Content-Type': 'application/json'},
body: {
"when": {
"query": "SELECT * FROM system.local WHERE key='local'"
},
"then": {
"rows": [
{
"cluster_name": "custom cluster name",
"partitioner": "org.apache.cassandra.dht.Murmur3Partitioner",
"data_center": "dc1",
"rack": "rc1",
"tokens": [
"1743244960790844724"
],
"release_version": "2.0.1"
}
],
"result": "success",
"column_types": {
"tokens": "set<text>"
}
}
}
}

Issue sending metrics with statsd

I was using the following instructions to install and configure StatsD on a Graphite server:
https://www.digitalocean.com/community/tutorials/how-to-configure-statsd-to-collect-arbitrary-stats-for-graphite-on-ubuntu-14-04
Now that I have a server with StatsD running, I do not see the metrics being logged under /var/log/statsd/statsd.log when I am testing sending them from the command line. Here is what I see:
29 Oct 02:30:39 - server is up
29 Oct 02:47:49 - reading config file: /etc/statsd/localConfig.js
29 Oct 02:47:49 - server is up
29 Oct 14:16:45 - reading config file: /etc/statsd/localConfig.js
29 Oct 14:16:45 - server is up
29 Oct 15:36:47 - reading config file: /etc/statsd/localConfig.js
29 Oct 15:36:47 - DEBUG: Loading server: ./servers/udp
29 Oct 15:36:47 - server is up
29 Oct 15:36:47 - DEBUG: Loading backend: ./backends/graphite
29 Oct 15:36:47 - DEBUG: numStats: 3
The log stays at the last entry of 'numStats: 3', even though I keep entering different metrics at the command line.
Here are a sample of the metrics I entered:
echo "sample.gauge:14|g" | nc -u -w0 127.0.0.1 8125
echo "sample.gauge:10|g" | nc -u -w0 127.0.0.1 8125
echo "sample.count:1|c" | nc -u -w0 127.0.0.1 8125
echo "sample.set:50|s" | nc -u -w0 127.0.0.1 8125
Of interest, I see this under /var/log/statsd/stderr.log:
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at Server.listen (net.js:1135:5)
at /usr/share/statsd/stats.js:383:16
at null.<anonymous> (/usr/share/statsd/lib/config.js:40:5)
at EventEmitter.emit (events.js:95:17)
at /usr/share/statsd/lib/config.js:20:12
at fs.js:268:14
at Object.oncomplete (fs.js:107:15)
Here is what my localConfig.js file looks like:
{
graphitePort: 2003
, graphiteHost: "localhost"
, port: 8125
, graphite: {
legacyNamespace: false
},
debug: true,
dumpMessages: true
}
Would anybody be able to shed some light as to where the problem lies?
Thanks!
There is a management interface available by default on port 8126: https://github.com/etsy/statsd/blob/master/docs/admin_interface.md
You likely have another service listening on that port in the same system.
Try this:
# localConfig.js
{
graphitePort: 2003
, graphiteHost: "localhost"
, port: 8125
, mgmt_port: 8127
, graphite: {
legacyNamespace: false
},
debug: true,
dumpMessages: true
}
See https://github.com/etsy/statsd/blob/master/exampleConfig.js#L28

Resources