1006 Connection closed abnormally error with python 3.7 websockets
So I found the solution:
When the connection closes, it breaks out of the while loop for some reason. So in order to keep the websocket running you have to surround
resp = await websocket.recv()
with try ... except and have
print('Reconnecting')
websocket = await websockets.connect(ws_url)
in the exception handling part.
Websocket closed code: 1006 Node Android okhttp3 AmazonEc2
The wierd part is that it was working once or twice before failing which was causing confusion. If it always failed and fave a logcat that would have been nice. The best way is to log all the possible errors/failures on server and client and see the message.
First Put The Log Inside On Failure
@Override
public void onFailure(@NotNull WebSocket webSocket, @NotNull Throwable t, okhttp3.@org.jetbrains.annotations.Nullable Response response) {
super.onFailure(webSocket, t, response);
Log.d("TAG", "websocket failure: " + t + response);
}
That gave the following message :
: `websocket failure: android.view.ViewRootImpl$CalledFromWrongThreadException:
Only the original thread that created a view hierarchy can touch its views.null`
Then Wrap the popluation of recycler view in this
getActivity().runOnUiThread(new Runnable() {
public void run() {
// Poplulate the recycler view here....
}
Related Topics
Redirect to Url After Form Submit in React
How to Make My Discord Bot Send a Message When a Specific User Plays a Specific Game
Pass Node Js Variable to Ejs Template
Jquery Get Closest Td Text Value
How to Wait Until 2 $Http Requests End in Angularjs
How to Print Image from Browser Using JavaScript
Make Angular.Foreach Wait for Promise After Going to Next Object
Angular2: Show Placeholder Image If Img Src Is Not Valid
React State Change Not Causing Re-Render
Angularjs Directive Does Not Update on Scope Variable Changes
Mobile Safari Sometimes Does Not Trigger the Click Event
How to Change Height in Mat-Form-Field
How to Iterate Through Json Nested Objects With Ngfor
How to Mute Video With JavaScript or Jquery
Refresh Leaflet Map: Map Container Is Already Initialized
Reload Table After Deleting an Item from It With React