odd-app-template
odd-app-template copied to clipboard
Device linking reliability
I've done some testing of device linking and it is uh reliably unreliable; in numerous tests with various browsers / OS, device linking stalls:
- in browser A, open the devtools and network tab and filter by 'WS'. Notice there seems to be 2 connections? Click on one connection to view the messages
- in browser A, click on "connect an additional device", then copy the url
- in browser B, paste and go to the url, then open the devtools / network tab and filter by 'WS'.
What happens:
- while the numeric code will likely appear in browser B, the code entry field never appears in browser A
- If you look at the WS connection in browser A, you see binary messages being received that decode to something like this:
{
"iv":"aODILVs2hrs6aCaSEgbP+g==",
"msg":"Rss0HEgjpecVMPpbvUBu4rvsUetzSvCfDZNhzozXQpjBFkvBMEUYbx9OpRnPmsv0HrWGDxczg7U7FMJaH8bJSMdidj9t+Srt25jsq3R7n51xyMCi7pfQORzRZoP+SI63cP65J4/6ZNi4iBzQTedod6nw9An09VDOfzkoo1Nw26RaE7Iupepa6/LzaOU6O+cebD6wm3+SMwBVvgxnw3S3uokJwV2uVs0f7lsxkKhjGc9/7hyNx+HdnQOBkXJi7duq5ybRAMFvKa6TUBzYqDlxKrRU7eHOkh9oV6JvgXtn5tZfjUehtgHxbPX+5D0hxGSfgGZVs6rwHflGE5uXwhEd0SBpyb5ch8KpQgJW/SPsi2fPYE9klErz0iisDOCI92OvOL0P+0ta0RXhnmI4R7xOqiTqUyjD+Ogw/8zOEnMZkYiOOjvKe34eJ5DIU5TSQ6d3RlnRtxfJPsFyghIEFHtg2QBEmmG4XJeyH6btPECGNbjFIlrokCLFAPRJq0J5POOwqw011eOxYepOsFpjbu7IZMFUSzxbPllVxej+AVzfKgHc7GtK27B8Io++Y41fgRiIbqMh7CcuMfHCp8WaGdxqVqUwjqLweTWrjYZjI38="}
When the browsers are in this state, I have seen it start working after refreshing browser A, but this is not reliable.
In a successful device linking session I see WS messages being sent from browser A in response to browser B, but this never happens on the first attempt to link.
As a first step on this issue - we should deploy and test with versions of WAT etc and webnative 0.34, not the currently deployed version. No use in trying to fix a bug that's already fixed.
Andy fixed this issue in the 0.35 branch The issue was indeed that the connection was opened multiple times.
I've attempted a reproduction in https://github.com/fission-codes/aol-demo/tree/upgrade-webnative-0.35.0 to gather more information from a second app.
The issue was not reproducible on a couple of attempts linking between desktop browsers including:
- Chrome -> Safari
- Chrome -> Firefox container
There were however issues linking from Desktop Firefox to Chrome on iOS. The symptoms are a bit different. Using chrome://inspect logging, the following is logged:

These messages are logged here: https://github.com/fission-codes/webnative/blob/3bd09cdd70d24d6df32cf9630d6565b9b2beff5b/src/components/auth/channel.ts#L53-L87
It seems like this should make more than just two attempts.
Safari iOS has a similar issue as Chrome on iOS.
Starting the linking process there while debugging in macOS Safari shows the following output:
As with Chrome on iOS, we are only making two attempts.
The Chrome on iOS and Safari iOS issues with retries described above are fixed in https://github.com/fission-codes/webnative/issues/446.