Getting empty message with paper streaming

Hi Alpaca staff,

I am trying to get used to alpaca-py and set up my paper trading algorithm. I’ve read docs and watched videos regarding the topic, but found that the mismatch of the syntax between the versions. I am now able to get the credantials authorized, but then got empty message when trying to listen to the live stream.

The script I used is here:

import config
import websocket, json

def on_open(ws):
    print("opened")
    auth_data = {
        "action": "authenticate",
        "key": config.API_KEY, "secret": config.SECRET_KEY
    }
    ws.send(json.dumps(auth_data))
    listen_message = {"action": "listen", "data": {"streams": ["AM.SPY"]}}
    ws.send(json.dumps(listen_message))

def on_message(ws, message):
    print("received a message")
    print(message)

def on_close(ws):
    print("closed connection")

socket = "wss://paper-api.alpaca.markets/stream"
# socket = "wss://api.alpaca.markets/stream"
ws = websocket.WebSocketApp(socket, on_open=on_open, on_message=on_message, on_close=on_close)
ws.run_forever()

Any thought, and I am also wondering what is the best setup for paper and live streaming today?