iOS Question WebSocket Close

Discussion in 'iOS Questions' started by aaronk, Nov 8, 2018 at 9:58 AM.

  1. aaronk

    aaronk Well-Known Member Licensed User

    Hi,

    I am using a websocket in my B4i app. I am connecting it to my B4J app.

    I have used:
    Code:
    ' Check make sure WebSocket is Initialized before trying to connect 
    If ws.IsInitialized = False Then ws.Initialize("ws")
       
        
    ' connect to WebSocket server
        ws.Connect("wss://192.168.0.88:5001/app")
    The app connects to my B4J webocket server fine, and triggers the ws_Connected sub once the connection is made. (which is fine)

    However if I call:
    Code:
    ws.Close
    It never triggers:
    Code:
    Private Sub ws_Closed (Reason As String)
        
    Log("**Connection Lost**")
        
    Log("Reason: " & Reason)
    End Sub
    If I loose connection to my B4J Server it also doesn't Tigger the ws_Close sub. (nothing gets logged when the connection is lost.)

    Using B4i Version 5.00
    iWebSocket Lib 1.10

    Anyone know what might be wrong or what I might of missed ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is expected not to fire when you call close as the event listener is removed.

    Kill the B4J server and then try to send something. It is expected to fire.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice