question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not add reverse socket connection

See original GitHub issue

Issue Checklist

  • I’m using the library programmatically

Library version

0.0.14

Runtime

Linux, Chrome Version 100.0.4896.127 (Official Build) (64-bit)

Device

DJI FPV goggles V2

Describe the bug

I am trying to add a reverse socket connection, basically what adb reverse tcp:0 tcp:6666 does:

const credentialStore = new AdbWebCredentialStore();
const device = await AdbWebUsbBackend.requestDevice();
const streams = await device.connect();
const adb = await Adb.authenticate(streams, credentialStore, undefined);
await adb.reverse.add("tcp:0", "tcp:6666", {
  onSocket: (packet, socket) => {
    //...
  }
});

Is resulting in this error:

Error: Stream ended
    at AdbBufferedStream.read (buffered.ts:49:1)

I could trace it till here, seems something fails during de-serialization: https://github.com/yume-chan/ya-webadb/blob/d0a8257a2dd7e315bc191565695c22330e588f7a/libraries/adb/src/commands/reverse.ts#L95

Steps to reproduce

const credentialStore = new AdbWebCredentialStore();
const device = await AdbWebUsbBackend.requestDevice();
const streams = await device.connect();
const adb = await Adb.authenticate(streams, credentialStore, undefined);
await adb.reverse.add("tcp:0", "tcp:6666", {
  onSocket: (packet, socket) => {
    //...
  }
});

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yume-chancommented, May 2, 2022

Version 0.0.15 released with the compatibility fix for Android 7 (and older) and some API changes.

Here is an example, I only tested it on Android 9 because this device has netcat.

https://github.com/yume-chan/ya-webadb/blob/12f88c355c63a8fbfc677adef1c2a5c6675195cb/apps/demo/src/pages/reverse.tsx#L17-L31

image

image

The handler now needs to return true to accept the connection, otherwise the dispatcher will ask the next handler (if any) and ultimately reject it. No packet will arrive before return, and .pipeTo(new WritableStream()) is the most common method to handle a stream in Web Streams API.

The second parameter is now a string and it can be any value without null characters.

0reactions
yume-chancommented, May 2, 2022

Glad to hear that!

Read more comments on GitHub >

github_iconTop Results From Across the Web

socket.io example sometimes not connecting client side when ...
Using node-http-proxy, I've set up a reverse proxy for routing requests:
Read more >
Reverse Proxy Support #1754 - socketio/socket.io - GitHub
I've configured nginx to act as a reverse proxy to socket.io server under a specific url (/socket/). It works. I load the Socket....
Read more >
Troubleshooting connection issues | Socket.IO
You are trying to reach a plain WebSocket server; The server is not reachable; The client is not compatible with the version of...
Read more >
What can I do if I see "Cannot connect to WebSocket" when ...
Go to Control Panel > Application Portal > Reverse Proxy. · Select the rule with the issue and click Edit. · Go to...
Read more >
Python Reverse Shell Tutorial - 2 - Binding the Socket and ...
10 Programming Languages in ONLY 15 minutes! · 18 Commands That Will Change The Way You Use Linux Forever.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found