plugins/clnrest: removing notifications queue in favor of websocket server

This commit is contained in:
Shahana Farooqui
2023-07-15 00:22:14 -07:00
committed by Rusty Russell
parent 2ab0b4af3e
commit 5e3ffc468b
3 changed files with 1 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
import json5
from flask import request, make_response, Response, stream_with_context
from flask import request, make_response
from flask_restx import Namespace, Resource
from .shared import call_rpc_method, verify_rune, process_help_response
from .rpc_plugin import plugin
@@ -56,17 +56,3 @@ class RpcMethodResource(Resource):
except Exception as err:
plugin.log(f"Error: {err}", "error")
return json5.loads(str(err)), 500
@rpcns.route("/notifications")
class NotificationsResource(Resource):
def get(self):
try:
def notifications_stream():
while True:
from .rpc_plugin import queue
yield queue.get()
return Response(stream_with_context(notifications_stream()), mimetype="text/event-stream")
except Exception as err:
return json5.loads(str(err)), 500