polar icon indicating copy to clipboard operation
polar copied to clipboard

Feature Request: Add websockets support for core-lightning

Open niteshbalusu11 opened this issue 1 year ago • 4 comments

core-lightning introduced websockets to talk the node using --experimental-websocket-port=PORT flag. Their unix sockets is something very hard to get it working with docker. Maybe websockets should be easy to add?

Their gRPC is too incomplete to be able to perform any meaningful dev work and REST is managed in-house and uses external libraries which I am not a fan of. Maybe websockets could be the way to go until gRPC gets developed.

niteshbalusu11 avatar Oct 01 '22 15:10 niteshbalusu11

That sounds pretty cool, but I'm not too fond of implementing features of the node implementations until they are out of the "experimental" stage.

If you want to play with it now, you can open the Advanced Options for the Core Lightning node in Polar and modify the startup command to add this flag. Polar won't surface any of the connection information in the UI, but you should still be able to use the websocket from your app.

jamaljsr avatar Oct 01 '22 17:10 jamaljsr

But don't you have to rebuild the docker image exposing an extra port and also adding ports for websocket in polar's code for them to be exposed at run time? Adding the port in the conf settings wont expose it. Is there an easier way?

niteshbalusu11 avatar Oct 01 '22 17:10 niteshbalusu11

Yes, that is partially correct. You wouldn't have to rebuild the image, but you would need the docker-compose file to be updated to expose the websocket port to the host machine.

A simple yet hacky workaround that's doable with Polar right now is to just repurpose the gRPC port that's already exposed to the host machine. So just replace --grpc-port=11001 with --experimental-websocket-port=11001 in the Advanced Options startup command. The Connect tab in the Polar sidebar would still display "GRPC Host", but this will actually be the websocket port that CLN is listening on.

jamaljsr avatar Oct 02 '22 01:10 jamaljsr

I forked polar and made changes, I'll submit a PR and you can review and merge it whenever you feel comfortable about it.

niteshbalusu11 avatar Oct 02 '22 02:10 niteshbalusu11