Replies: 3 comments 5 replies
-
Yes, with basic auth
Here is an example with
It's for payments received. |
Beta Was this translation helpful? Give feedback.
-
Assuming you're trying to connect from a Node app you can use something like this: const socket = new WebSocket(url, {
headers: {
Authorization:
"Basic " + Buffer.from(":" + password).toString("base64"),
},
}); This exmple uses |
Beta Was this translation helpful? Give feedback.
-
I did something similar using the WebSocket package for Python: import asyncio
import signal
import websockets
async def shim(websocket):
uri = "ws://token:a6a3c41245dec52d57af36dd2887dce0334b7e85381a15696455cf7f0734e5d2@127.0.0.1:9740/websocket"
async with websockets.connect(uri) as websocket1:
# Close the connection when receiving SIGTERM.
loop = asyncio.get_running_loop()
loop.add_signal_handler(
signal.SIGTERM, loop.create_task, websocket1.close())
# Process messages received on the connection.
async for message in websocket1:
print(f"Received: {message}")
await websocket.send(message)
async def main():
async with websockets.serve(shim, "localhost", 8765):
await asyncio.Future() # run forever
if __name__ == "__main__":
asyncio.run(main()) I'm trying to create something like a ticker that shows received payments. This shim should let me create a local browser page that connects to the web socket created by my python shim at port 8765. |
Beta Was this translation helpful? Give feedback.
-
Could someone please clarify a couple of things for me...
Firstly, is authentication required to connect to the websocket endpoint? If not, how come? If it is then what's the approach?
Secondly, is the websocket connection used for notification of invoices paid (as an alternative to webhooks) or just invoices created? I'm not quite sure reading from the docs.
Beta Was this translation helpful? Give feedback.
All reactions