{ "id": "172867", "key": "TIMOB-26730", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2019-02-15T18:00:37.000+0000", "created": "2019-01-15T17:54:39.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2019-02-15T18:00:37.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "While working with Socket.io on iOS works fine, we are running into critical issues when using the module on Android. The first message works, after that the following error occurs and the communication is broken.\r\n\r\n{code}\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n[ERROR] Error in socket connection\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[WARN] W/com.appc.app: No such thread id for suspend: 29\r\n[WARN] System: A resource failed to call response.body().close().\r\n[INFO] chatty: uid=10108(com.appc.app) OkHttp Connecti identical 1 line\r\n[WARN] System: A resource failed to call response.body().close().\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n\r\n[ERROR] Error in socket connection\r\n[ERROR] {\"message\":\"xhr poll error\"}\r\n{code}\r\n\r\nMaybe the OKHTTP library used in the core clashes with this one?\r\n", "attachment": [], "flagged": false, "summary": "Android: Cannot use Socket.io module, closes connection after first message", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 1109, "state": "closed", "name": "2019 Sprint 3", "startDate": "2019-01-28T17:38:43.075Z", "endDate": "2019-02-09T17:38:00.000Z", "completeDate": "2019-02-08T21:37:29.498Z", "originBoardId": 114 }, { "id": 1112, "state": "closed", "name": "2019 Sprint 4", "startDate": "2019-02-11T16:16:38.316Z", "endDate": "2019-02-23T16:16:00.000Z", "completeDate": "2019-02-24T18:35:43.422Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "445457", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Google's Android OS uses the okhttp library internally, which is what the Android {{HttpUrlConnection}} Java class uses under the hood. So, this is most likely an okhttp library version conflict. Unfortunately, the only 100% ensured way of avoiding this issue is to either:\r\n# Recompile the entire okhttp library under a different namespace.\r\n# Remove the module's okhttp library usage and use some other API.\r\n\r\nI'm curious. What do you need from \"ti.socket\" that our core {{Ti.Network.Socket}} doesn't offer?", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-01-18T00:31:17.000+0000", "updated": "2019-01-18T00:31:17.000+0000" }, { "id": "445462", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks for the suggestion Josh! We didn't try Ti.Network.Socket so far, because the official socket.io library seemed to be the best match here and is pretty performant on iOS. Regarding the conflict: The module uses okhttp-3.11.0.jar and okio-1.14.1.jar, so maybe it's something there. We will also give the ti.network socket a shot!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-01-18T07:39:43.000+0000", "updated": "2019-01-18T07:39:43.000+0000" }, { "id": "445472", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~jquick] that module is for [socket.io|https://socket.io/], not just a simple socket ;) To use {{Ti.Network.Socket}} one would have to write a WebSocket implementation first and then use that to implement a socket.io client.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-01-18T19:04:30.000+0000", "updated": "2019-01-18T19:04:30.000+0000" }, { "id": "445473", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Oh gotcha. You're after the WebSocket protocol.\r\n\r\nSo, we could try updating the okhttp library to the newest version. Assuming that it's backward compatible with older Android OS versions and it doesn't conflict with what Google is using. It's worth a try. Although their newest version's min Android version supported is 5.0, which doesn't line-up with Titanium's min version of 4.4.\r\nhttp://square.github.io/okhttp\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-01-18T19:29:53.000+0000", "updated": "2019-01-18T19:29:53.000+0000" }, { "id": "445910", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "This is most likely due to a nginx reverse proxy setup. This prevents socket.io from successfully upgrading the http connection to a websocket connection. The iOS client handles this transparently by remaining in http polling mode. The Android client however seems to have issues with an upgrade error.\r\n\r\nPlease see the following link and see if your server setup is properly configured: https://www.nginx.com/blog/websocket-nginx/\r\n", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-02-07T14:34:13.000+0000", "updated": "2019-02-07T14:34:13.000+0000" }, { "id": "446104", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "This was indeed caused by a missing configuration in the nginx reverse proxy. Closing since it was fixed on the server side.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-02-15T18:00:37.000+0000", "updated": "2019-02-15T18:00:37.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }