bboerst / stratum-work

Websocket-based web app that streams realtime mining pool stratum messages to a table for analysis.
https://stratum.work
20 stars 0 forks source link

python3 stratum-work.py | jq -C #18

Open SatoshiNakamotoBitcoin opened 1 month ago

SatoshiNakamotoBitcoin commented 1 month ago

This tool for TUI can be amazing, we trying the wss but dont work, maybe hearbeat is needed via data to get the response?

`import websocket

def on_message(ws, message): print(message)

ws = websocket.WebSocketApp("wss://stratum.work", on_message=on_message) ws.run_forever()`

bboerst commented 1 month ago

Hi @SatoshiNakamotoBitcoin.

I hadn't considered opening up the websocket for others to connect to directly. This could indeed be valuable for others wanting to consume this data and utilize it in other ways, so I'm open to allowing it.

Your issue might be CORS-related. I'm only allowing certain origins at this time: https://github.com/bboerst/stratum-work/blob/6a33fedb7cccb07d741a98433385a5aae3dad8bc/webapp/main.py#L24

Let me brainstorm this a bit. I think if I were to allow this, I would want some sort of authorization token mechanism on the socket to prevent abusing the endpoint.

I think you bring up a good idea, so let me think about how to allow this functionality.

SatoshiNakamotoBitcoin commented 1 month ago

We make this 2 similar purposes :

https://github.com/curly60e/pyblock/blob/master/pybitblock/WebSocket-BitNodes.py Bitnodes

https://github.com/curly60e/pyblock/blob/master/pybitblock/WebSocket-LiveTxs.py Live Txs

Thi idea is the same, python3 ..... | jq -C to view the data via TUI.

Take a look, is good to play like: | jq -C .count or other ways like Grep to get specific info based on the wss responses.

Thanks in advance.