Closed lamby closed 1 year ago
en,it also can't work with jquery in the example,it use XMLHttpRequest and readyStatus = 3 but jquery seems not support it! the example code is:
var previous_response_length = 0 xhr = new XMLHttpRequest() xhr.open("GET", "http://127.0.0.1:7379/SUBSCRIBE/hello", true); xhr.onreadystatechange = checkData; xhr.send(null);
function checkData() {
if(xhr.readyState == 3) {
response = xhr.responseText;
chunk = response.slice(previous_response_length);
previous_response_length = response.length;
console.log(chunk);
}
};
but jquery seems not support it!
That would appear to be an entirely separate issue.
you need to unbuffer the output: with curl its -N
$ curl -N localhost:7379/SUBSCRIBE/testing
{"SUBSCRIBE":["subscribe","testing",1]}
and then
$ curl localhost:7379/PUBLISH/testing/hello
{"PUBLISH":1}
and subscriber will look like this:
$ curl -N localhost:7379/SUBSCRIBE/testing
{"SUBSCRIBE":["subscribe","testing",1]}{"SUBSCRIBE":["message","testing","hello"]}
Ah, neat. :)
6 years later :D
I literally can't remember trying out webdis. :laughing:
@lamby I know the feeling.
Thanks for the curl
tip @matti, I'll add this to the docs.
Terminal 1:
Terminal 2:
There is no change in terminal 1. I was expecting a
{"SUBSCRIBE...
line. What am I missing?