Skip to content

Websocket over devtunnel is not working #291

Closed

Description

@flvcode

I am trying to connect a websocket over the devtunnel but the connection is not fully established.
I am trying using the wss:// protocol over the https:// endpoint.

Are websockets currently supported?

Activity

  1. derekbekoe commented on Aug 15, 2023

    @derekbekoe
    Contributor

    Yes websockets are supported.
    Can you share more information to help us resolve your issue?

  2. flvcode commented on Aug 15, 2023

    @flvcode
    Author

    I am running a simple java websocket server locally on port 8080.
    My websocket client is postman for testing purposes.

    I can connect to ws://localhost:8080 with no issues.
    Also I am able to use ngrok for this port but I want to switch to using devtunnels.

    For devtunnels I use: wss://TUNNELID-8080.use.devtunnels.ms.
    This tunnel has port 8080 set to auto.

    Should I explicitly add the wss protocol for port 8080?

    When trying to connect over devtunnels, I get the callback for connectionEstablished in my ws server but nothing after that.
    No message can be received. Also no callback for closing the ws.
    The connection never moves past Connecting in the postman client.

    What am I missing?
    What other details should I provide to help debug this issue?

    Here is my verbose output:

    HostSSH: Receiving #23 ChannelOpenMessage(ChannelType: client-ssh-session-stream, SenderChannel: 1)
    ClientSSH: SshServerSession:34817906 ConnectAsync
    HostSSH: Sending #23 ChannelOpenConfirmationMessage(RecipientChannel: 1)(SenderChannel: 1)
    HostSSH: SshClientSession:33592719 OnChannelOpenCompleted(SshChannel(Type: client-ssh-session-stream, Id: 1, RemoteId: 1))
    ClientSSH: Sending #0 KeyExchangeInitMessage
    HostSSH: Receiving #26 ChannelWindowAdjustMessage(RecipientChannel: 1)(BytesToAdd: 4194343)
    HostSSH: Sending #26 ChannelWindowAdjustMessage(RecipientChannel: 1)(BytesToAdd: 4194343)
    ClientSSH: Local version: SSH-2.0-Microsoft.DevTunnels.Ssh_3.11, remote version: SSH-2.0-Microsoft.DevTunnels.Ssh_3.11
    ClientSSH: Receiving #0 KeyExchangeInitMessage
    ClientSSH: KeyExchange negotiation: Server (diffie-hellman-group16-sha512, diffie-hellman-group14-sha256) Client (ecdh-sha2-nistp384, ecdh-sha2-nistp256, diffie-hellman-group16-sha512, diffie-hellman-group14-sha256, ext-info-c) => diffie-hellman-group16-sha512
    ClientSSH: PublicKey negotiation: Server (ecdsa-sha2-nistp384) Client (rsa-sha2-512, rsa-sha2-256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp256) => ecdsa-sha2-nistp384
    ClientSSH: ClientEncryption negotiation: Server (aes256-cbc, aes256-ctr) Client (aes256-gcm@openssh.com, aes256-cbc, aes256-ctr) => aes256-cbc
    ClientSSH: ServerEncryption negotiation: Server (aes256-cbc, aes256-ctr) Client (aes256-gcm@openssh.com, aes256-cbc, aes256-ctr) => aes256-cbc
    ClientSSH: ClientHmac negotiation: Server (hmac-sha2-512-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512, hmac-sha2-256) Client (hmac-sha2-512-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512, hmac-sha2-256) => hmac-sha2-512-etm@openssh.com
    ClientSSH: ServerHmac negotiation: Server (hmac-sha2-512-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512, hmac-sha2-256) Client (hmac-sha2-512-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512, hmac-sha2-256) => hmac-sha2-512-etm@openssh.com
    ClientSSH: ClientCompression negotiation: Server (none) Client (none) => none
    ClientSSH: ServerCompression negotiation: Server (none) Client (none) => none
    ClientSSH: Receiving #1 KeyExchangeDhInitMessage
    ClientSSH: Sending #1 KeyExchangeDhReplyMessage
    ClientSSH: Sending #2 NewKeysMessage
    ClientSSH: Receiving #2 NewKeysMessage
    ClientSSH: Sending #3 ExtensionInfoMessage(open-channel-request@microsoft.com; server-sig-algs=rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256; session-latency@microsoft.com; session-reconnect@microsoft.com)
    ClientSSH: SshServerSession:34817906 encrypted
    ClientSSH: Receiving #3 ExtensionInfoMessage(open-channel-request@microsoft.com; server-sig-algs=rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256)
    ClientSSH: Receiving #4 ServiceRequestMessage(Service: ssh-userauth)
    ClientSSH: Sending #4 ServiceAcceptMessage(Service: ssh-userauth)
    ClientSSH: Receiving #5 AuthenticationRequestMessage(Method: none, Username: tunnel)
    ClientSSH: SshServerSession:34817906 Authenticating(Username: tunnel, Key: password)
    ClientSSH: ClientNone authentication succeeded.
    ClientSSH: Sending #5 AuthenticationSuccessMessage
    ClientSSH: Sending #6 PortForwardRequestMessage(RequestType: tcpip-forward)(AddressToBind: localhost, Port: 3000)
    ClientSSH: Sending #7 PortForwardRequestMessage(RequestType: tcpip-forward)(AddressToBind: localhost, Port: 5500)
    ClientSSH: Sending #8 PortForwardRequestMessage(RequestType: tcpip-forward)(AddressToBind: localhost, Port: 8080)
    ClientSSH: Receiving #6 SessionRequestSuccessMessage
    ClientSSH: Receiving #7 SessionRequestSuccessMessage
    ClientSSH: Receiving #8 SessionRequestSuccessMessage
    ClientSSH: Receiving #9 ChannelOpenMessage(ChannelType: forwarded-tcpip, SenderChannel: 0)
    ClientSSH: PortForwardingService forwarded channel #0 connection to 127.0.0.1:8080.
    ClientSSH: Sending #9 ChannelOpenConfirmationMessage(RecipientChannel: 0)(SenderChannel: 0)
    ClientSSH: SshServerSession:34817906 OnChannelOpenCompleted(SshChannel(Type: forwarded-tcpip, Id: 0, RemoteId: 0))
    
  3. derekbekoe commented on Aug 15, 2023

    @derekbekoe
    Contributor

    Is the tunnel (or the specific port 8080) set to public?

  4. flvcode commented on Aug 16, 2023

    @flvcode
    Author

    Yes. Here are my details

    % devtunnel show
    
    Tunnel ID             : {TUNNELID}.use
    
    Name                  : 
    
    Description           : 
    
    Tags                  : 
    
    Access control        : {+Anonymous [connect]}
    
    Host connections      : 1
    
    Client connections    : 0
    
    Current upload rate   : 2639 bytes/s (limit: 5 MB/s)
    
    Current download rate : 2415 bytes/s (limit: 5 MB/s)
    
    Upload total          : 88 KB
    
    Download total        : 66 KB
    
    Ports                 : 3
    
      3000  auto  https://{TUNNELID}-3000.use.devtunnels.ms/  
    
      5500  auto  https://{TUNNELID}-5500.use.devtunnels.ms/  
    
      8080  auto  https://{TUNNELID}-8080.use.devtunnels.ms/  
    
    Tunnel Expiration     : 30 days
    
  5. flvcode commented on Aug 31, 2023

    @flvcode
    Author

    Issue got solved without any changes on my end. Also no devtunnels update.

    Maybe a network issue solved a reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions