Trying to use Redis to pass updates to my HTML. However the Javascript is throwing an error that it cant find the url for the stream. I beleive the Redis is running but when i double click on the server file it immidiately closes however i do recieve a pong when i ping it.
var source = new EventSource("{{url_for('sse.stream')}}");
source.addEventListener('update', function(event){
var data = JSON.parse(event.data);
alert("The Server Says"+data.message);
}, false);
source.addEventListener('error',function(event){
alert("Failed");
}, false);
app.config['REDIS_URL'] = "redis://localhost"
app.register_blueprint(sse, url_prefix='/stream')
@app.route('/UserUpdate')
@login_required
def user_update(stockvalue):
print("There has been a sale")
print(stockvalue)
sse.publish({"CashUpdate":"£100"},type="update")
The Error is Failed to load resource: %7B%7Burl_for('sse.stream')%20%7D%7D:1 the server responded with a status of 404 (NOT FOUND)