cryptostore icon indicating copy to clipboard operation
cryptostore copied to clipboard

Tcp example - empty message

Open Antc1993 opened this issue 1 year ago • 0 comments

Hi, I'm trying to get the TCP example to work, but I only get an empty message I know that I am creating the server and it is connecting correctly, but nothing is coming through. I tried running this command docker run -e EXCHANGE=BINANCE -e CHANNELS=candles -e SYMBOLS=BTC-USDT -e BACKEND=TCP -e HOST=tcp://127.0.0.1 -e PORT=8080 -p 8080:8080 ghcr.io/bmoscon/cryptostore:latest and a script outside of docker and I get the same result

Image

version: "3.3"
services:
  cryptofeedcandles:
    image: antc1993/cryptofeedcandles
  cryptostore2tty:
    image: ghcr.io/bmoscon/cryptostore:latest
    environment:
      - EXCHANGE=BINANCE
      - CHANNELS=trades
      - SYMBOLS=BTC-USDT
      - BACKEND=TCP
      - HOST=tcp://172.18.0.2
      - PORT=8080
    ports:
      - "8080:8080"
    depends_on:
      - cryptofeedcandles

cryptofeedcandles

import asyncio
from decimal import Decimal
import json


async def reader(reader, writer):
    while True:
        data = await reader.read(1024 * 640)
        message = data.decode()
        
        addr = writer.get_extra_info('peername')
        print(f"Received {message!r} from {addr!r}")

        print(f"Send: {message!r}")
        


async def main():
    server = await asyncio.start_server(reader, '0.0.0.0', 8080)
    async with server:
        await server.serve_forever()


if __name__ == '__main__':
    asyncio.run(main())

I don't realize where I'm going wrong

Antc1993 avatar Mar 27 '25 00:03 Antc1993