diff --git a/openlp/core/api/endpoint/core.py b/openlp/core/api/endpoint/core.py index bfe8a0e54..d9f25a42a 100644 --- a/openlp/core/api/endpoint/core.py +++ b/openlp/core/api/endpoint/core.py @@ -107,13 +107,15 @@ def index(request): return blank_endpoint.render_template('index.mako', **TRANSLATED_STRINGS) +@blank_endpoint.route('api/poll') @blank_endpoint.route('poll') def poll(request): """ Deliver the page for the /poll url + :param request: """ - return Registry().get('poller').raw_poll() + return Registry().get('poller').poll() @blank_endpoint.route('api/display/{display:hide|show|blank|theme|desktop}') diff --git a/openlp/core/api/poll.py b/openlp/core/api/poll.py index f51cf4d4f..42a8dec23 100644 --- a/openlp/core/api/poll.py +++ b/openlp/core/api/poll.py @@ -53,7 +53,7 @@ class Poller(RegistryProperties): """ Poll OpenLP to determine the current slide number and item name. """ - return json.dumps({'results': self.raw_poll()}).encode() + return {'results': self.raw_poll()} def main_poll(self): """ diff --git a/openlp/core/api/websockets.py b/openlp/core/api/websockets.py index 478784225..9d4aae5d7 100644 --- a/openlp/core/api/websockets.py +++ b/openlp/core/api/websockets.py @@ -27,6 +27,7 @@ with OpenLP. It uses JSON to communicate with the remotes. import asyncio import websockets +import json import logging import time @@ -130,7 +131,7 @@ class WebSocketServer(RegistryProperties, OpenLPMixin): while True: current_poll = poller.poll() if current_poll != previous_poll: - yield from request.send(current_poll) + yield from request.send(json.dumps(current_poll).encode()) previous_poll = current_poll yield from asyncio.sleep(0.2) elif path == '/live_changed':