Exchange Stream API - HttpException: Connection reset by peer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andybeef
    Junior Member
    • Oct 2013
    • 3

    #1

    Exchange Stream API - HttpException: Connection reset by peer

    I'm trying to connect to the the Stream API in my Flutter app which is written in Dart. From what I can tell this should be a fairly straight forward process but I'm receiving an exception from Betfair.

    Here is my code:

    Code:
    listenToStream() {
       final channel = WebSocketChannel.connect(Uri.parse('ws://stream-api.betfair.com:443'));
    
       channel.stream.listen((message) {
          print("$message"); // Expecting to see something like: {"op":"connection","connectionId":"002-230915140112-174"} but not seeing anything
       });
    }​
    I am receiving this error:

    Code:
    Unhandled Exception: WebSocketChannelException: WebSocketChannelException: HttpException: Connection reset by peer, uri = http://stream-api.betfair.com:443
    What does this error mean? Am I supposed to be passing any information to the API with the connect request?
  • TooLateToTheParty
    Junior Member
    • Jan 2021
    • 10

    #2
    Hi Andy

    I don't know Dart but after connecting I have to send authentication that includes my app key and session id. HTH

    Comment

    • andybeef
      Junior Member
      • Oct 2013
      • 3

      #3
      That's the Authenticate part, unfortunately I've not been able to get that far yet. After attempting to connect the only thing I receive is the error.

      Comment

      • BetfairDeveloperProgram
        Administrator
        • Oct 2008
        • 680

        #4
        Hi Andy

        Are you using the correct connection class? See the relevant links below:

        https://docs.developer.betfair.com/d.../SSLConnection

        https://api.dart.dev/be/180361/dart-...ket-class.html

        Kind Regards

        Neil

        Comment

        • andybeef
          Junior Member
          • Oct 2013
          • 3

          #5
          Thanks Neil, I think you've pointed me in the right direction.

          Comment

          • karateace
            Junior Member
            • May 2023
            • 1

            #6
            Hi Andy

            Are you using the correct connection class? See the relevant links below:

            https://docs.developer.betfair.com/d.../SSLConnection

            https://api.dart.dev/be/180361/dart-...ket-class.html Territorial Io

            Kind Regards

            Neil​
            Oh. This is what I am finding
            Last edited by karateace; 11-05-2023, 05:31 PM.

            Comment

            • airlinedisloyal
              Junior Member
              • Oct 2023
              • 1

              #7
              Without knowing Dart, I just connected and now I have to transmit authentication with my app key and session id.
              dordle

              Comment

              Working...
              X