gatt.disconnect() is initiated host but not by the app - bluetooth

I've been breaking my head with this issue....
i send a gatt.write command to my remote device, sometimes getting response and sometimes not because the gatt disconnects at all times from my app! (when using the nrf app for writing this value it doesnt disconnect)
when exploring the issue with WireShark using btsnoop_hci.log
I see that the host is initiating disconnect, but my app is not sending!!! went over with debugger on every possible disconnect.
I'm attaching the log output:

Related

Socket.io not generating unique socket ID per connection on Heroku

Heroku back logs are showing the same amount of user connected even with two different devices.
However, localhost is working fine. Each time a device connects, a new socket is generated. This is not the case on Heroku.
So its connecting fine, but that connection is the same across two different devices?
I had the server clustered. Removing that fixed the issue.
Looks like Socket.io requires additional configuration if you're going to cluster node.

Expo cant get data from json-server node.js

I recently started to learn react native. I have such a problem.
I launch the Expo application and it works I go to the subitem where the data is taken from the json server and there is empty. Writes a network request failed. As I understand data from the server is not read.
Here is more detailed.
First, run json server, type json-server --watch db.json -p 3001 at the command prompt. It all started. I’ll go into the browser and type localhos: 3001 / books. And the data appears. As I understand it answers the request.
Next, run react native. Everything loads, runs in the metro bundler browser (localhost: 19002).
There are three types of launching the program on the phone:
1.local and the address 127.0.0.1, as I understand it, it is needed to connect and run through the usb cable. I tried using this method the application starts. But the data does not appear. Writes a network request failed.
2.lan and the ip address of the computer, as I understand it through wi-fi. Since I don’t have a wifi router, I tried to give wifi from my computer. I connected a modem. And its began sharing wifi. I connected the phone and started it. It did not start at all. IP address of the computer in lan mode by default, takes IP address from the modem (192.168.8.100) and the phone (192.168.43.216). In short, the phone and the computer must be on the same local network. I think may be if I'll take another comp. It will be used as a Wi-Fi routet instead of a router. And then I’ll connect my working computer and phone to it. I configured ip addresses. Still not starting. I think that i did something wrong I am not an expert in local area networks. If you have any ideas, help.
3.tunnel did not quite understand how to use. I decided to share the wi-fi from the phone and make an access point. Connect my computer and ran. It seems to have started but still does not show data.
Please, help.
1) to form lan connection without wifi router.
2) how to read data from json server to the phone.
P.s. i killed 3 days trying to figure it out.
I copied the example from "Getting Started" in the README and then ran npx json-server --watch db.json -p 3001. I then went to http://localhost:3001/posts/1 in my browser and it worked as expected.
Next, I opened a new tab in terminal and ran npx ngrok http 3001 to expose create a tunnel to access the http server at port 3001 from anywhere. Once the tunnel started I saw the following information:
ngrok by #inconshreveable (Ctrl+C to quit)
Session Status online
Session Expires 7 hours, 58 minutes
Version 2.3.35
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://ef4b99ca.ngrok.io -> http://localhost:3001
Forwarding https://ef4b99ca.ngrok.io -> http://localhost:3001
I opened https://ef4b99ca.ngrok.io/posts/1 in my browser and it worked as expected (this will not work for you when you are reading this because I will have closed the ngrok tunnel and my json-server by then).
If you follow these steps and use the tunnel URL in your app you will be able to access it in development from your device.

linux troubleshoot connectivity issue but telnet working

Am using ActiveMQ for message publish/subscribe where it accepts the connection from the publisher. But sometime all of sudden its not accepting any connection from publisher client though the service is still running. And telnet also works fine in that time for the ActiveMQ port, but I had to restart ActiveMQ service to make the connection happen from publisher client to publish message.
During that I had done the basic checks like CPU,Mem usage, load average and IO wait and all are fine. Any idea how can we troubleshoot to find out what is causing the connectivity issue?

Whitelisted chromecast works with default tictactoe app ID but not mine

I am trying to get the tic tac toe demo from github working on my Chromecast after changing only the app id of the clients. With the default app id, I have been able to launch and play the game with an android client and a mac client.
I have:
Added my Chromecast device on the developer console (it has a green status indicator)
Set (via the Android Chromecast app) the Chromecast to send the device serial number
Verified that the serial number is correct
Verified with both the Android and Windows Chromecast apps that the serial# setting is retained
Power cycled the Chromecast
Setup an app id in the developer console (status is a grey circle labeled 'Unpublished')
Entered an internet accessible (not local) URL for the app id
Installed the receiver app at the above url and verified I can access it from a browser on the same network as the Chromecast
Also tried a local IP address (192.168.x.x) which I understand is supported as well
Modified the web client ttt.js file to use my app id (and verified app id is correct)
Modified the android client (GameActivity.java) to use my app id (and verified app id)
Did a git diff to make sure that I didn't inadvertently change anything else
Verified that my local copy of the source is the latest from git
When running the android client I can connect to my Chromecast but the Chromecast home screen shows "Brain Freeze", "We're sorry, but something could not load", "Activity aborted".
The logcat console in eclipse for the android device reports, "ConnectionResultCallback. Unable to launch the game. statusCode: 2002".
The web client on the Mac results in the same messages on the Chromecast and
'"reason":"CANCELLED","type":"LAUNCH_ERROR"'
on the web page output.
Is there a way to get more information from the Chromecast to indicate what is going wrong with the launch?
Follow Up
It turns out that the issue was in my network setup and not in my chromecast setup. After sniffing the network traffic with wireshark, I could see that the ARP request to retrieve the MAC address of my server was not getting a response. I am running my server on Virtualbox with a bridged adapter but needed to turn on promiscuous mode (allow all). Now the chromecast successfully launches the receiver app and I can play the tic tac toe game when using an HTTP based URL. (I need to fix the certificate for HTTPS).
Thanks Les, for the effort.
Did you verify that [x] send my serial # to Google has been checked (using the setup app)?
Also, did you wait 15 minutes and then restart your device (power cycle)?

Setting up a websocket capable application on an azure ubuntu vm

Okay, so I have created an ubuntu vm in the azure cloud, I have successfully launched nodejs, redis, socket.io, Express and all the components for a game I am writing.
I have setup azure endpoints on internal and external port 8080, and use app.listen(8080) in my js code.
When I browser to http://< app-name >.cloudapp.net:8080/ I can view the result of my nodejs application fine, it displays the html, css etc.
However when it attempts to start a socket connection (using socket.io) I get only this (on my chrome dev console under websockets):
HeadersPreviewResponseWebSocket Frames
Request URL:ws://<app-name>.cloudapp.net:8080/socket.io/1/websocket/13510496541533398587
Request Method:GET
Status Code:101 Switching Protocols
Request Headersview source
Connection:Upgrade
Host:<app-name>.cloudapp.net:8080
Origin:http://<app-name>.cloudapp.net:8080
Sec-WebSocket-Extensions:x-webkit-deflate-frame
Sec-WebSocket-Key:y5vueHE66phl70gle7KCtw==
Sec-WebSocket-Version:13
Upgrade:websocket
(Key3):00:00:00:00:00:00:00:00
Response Headersview source
Connection:Upgrade
Sec-WebSocket-Accept:dn+2lA6sMIXHLEmDS/Q4j/IIwxI=
Upgrade:websocket
(Challenge Response):00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
It will also crash the nodejs app on azure when i try send anything using socket.emit() on the client (browser); in my azure ssh, it just says 'DEBUG: Program node app.js exited with code null' which isn't particularly helpful.
So it obviously isn't connecting properly? I have also tried in my nodejs listening on port 80, but then I don't even get the standard webpage (html,css,etc).
From what I have read online, it is very possible to get sockets working providing your not using the web role (which I assume the vm is not).
Any idea how I can get this to work? (and preferably on port 80)?
Edit: starting to wonder if this has nothing todo with sockets, realized I get the same switching protocol message, on my home vm (where it is working). Spin off question: How can I view crash details for a nodejs program on a ubunu azure vm?
There is a time out of around 60s on the Windows Azure loadbalancer.
Does it work if you send a message back to the client just after the websocket connection is established?
If it is the case you will have to implement some keep a live message send every minutes.

Resources