0

I am trying to connect to Binance WebSocket API with the base endpoint: wss://stream.binance.com:9443

I want to utilize AWS Lambda to respond to certain price targets.

I looked at the AWS API gateway WebSocket documentation but it seems to be that we can use API gateway to host the Websocket API but not to connect as a client to another API.

Am I right in assuming that? Because I only see the tutorials and blog posts about how to create a WebSocket API but not how to connect TO a WebSocket through API gateway. Or is it because connect to WebSocket through API gateway is not the correct approach?

If the latter is the case could you please guide me on how I can utilize the AWS service to achieve this?

Very much appreciated

EDIT: I found this question that was asked a few years back but at that time, it seems no solution existed. Hoping this changed now --> Is it possible to subscribe to a WebSocket in a serverless fashion using AWS?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
sungazerr
  • 45
  • 5
  • 1
    Yeah, API Gateway Websocket accepts *incoming* websocket requests, it cannot make *outgoing* requests. AFAIK there's no way to have a persistent websocket connection from a Lambda. – deceze Sep 14 '21 at 12:23
  • Did you, or anyone, find a solution to receiving data from an external websocket server? I hoped there was a pattern available for websocket injestion with EventBridge (or another AWS capability). Currently, I'll need to roll my own client with an EC2 instance to connect and receive the data and then publish to an event bus for other AWS services to act on. I hoped to have it all serverless. This article covers a similar use case - https://aws.amazon.com/blogs/big-data/collect-and-distribute-high-resolution-crypto-market-data-with-ecs-s3-athena-lambda-and-aws-data-exchange – sub Jun 01 '22 at 00:51

0 Answers0