1

I'm connecting to a server using Websocket4Net, when I send a message, I receive the reply for that message, when I send a second message, I do net get the reply!

When I restart the connection, and send the second message again, I receive the reply!

So, within the same session, I only receive a reply for the first sent message, and not for second, third, etc...

This is the code I use to connect to the server:

    WSIWebSocket = New WebSocket(FinalURL)
    WSIWebSocket.Security.AllowNameMismatchCertificate = True
    WSIWebSocket.Security.AllowCertificateChainErrors = True
    WSIWebSocket.Security.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls
    WSIWebSocket.Security.AllowUnstrustedCertificate = True
    AddHandler WSIWebSocket.Opened, AddressOf WSIWebSocket_Opened
    AddHandler WSIWebSocket.Error, AddressOf WSIWebSocket_Error
    AddHandler WSIWebSocket.Closed, AddressOf WSIWebSocket_Closed
    AddHandler WSIWebSocket.MessageReceived, AddressOf WSIWebSocket_MessageReceived
    WSIWebSocket.Open()
Imad Abu Hayyah
  • 434
  • 4
  • 13
  • 1) Do you get any messages back in your `.Error` event? 2) Could we also see example code for sending the message. 3) just to confirm, you don't get any errors during `Open` or send? – tgolisch Oct 02 '18 at 15:13
  • Before your `Send`, could you check your `WSIWeb Socket.State` to confirm that you are actually connected. – tgolisch Oct 02 '18 at 15:18

1 Answers1

1

I have found the reason why I do not get the reply for the second message, in the first message reply, I do connect to DB2 database, where the app hangs for some seconds, which cause the web socket object to not able to send keep alive pings, and will be considered as disconnected by the server.

Imad Abu Hayyah
  • 434
  • 4
  • 13