Re: Websocket 200 error

2019-02-19 Thread flora . xiaoyun . huang
The redis issue solved, by revising redis configuration: config set 
stop-writes-on-bgsave-error no
And the redis server can be restarted.

On Monday, February 18, 2019 at 9:19:52 PM UTC-5, flora.xia...@gmail.com 
wrote:
>
> I am guessing maybe there is an issue with the redis-server? *The log I 
> received from Daphne*:
> 2019-02-18 21:07:54,543 ERRORError trying to receive messages: Error 
> running script (call to f_3640886a0c8901ca9188f5f7a5f7a346145b9c5f): 
> @user_script:3: @user_script: 3: -MISCONF Redis is configured to save RDB 
> snapshots, but is currently not able to persist on disk. Commands that may 
> modify the data set are disabled. Please check Redis logs for details about 
> the error.
>
> So I check *redis log*:
> [1418] 18 Feb 16:09:27.071 * 1 changes in 900 seconds. Saving...
> [1418] 18 Feb 16:09:27.072 * Background saving started by pid 2834
> [2834] 18 Feb 16:09:27.073 # Failed opening .rdb for saving: Permission 
> denied
> [1418] 18 Feb 16:09:27.172 # Background saving error
>
> I searched ways to solve the problem and set the permission of .rdb to 
> 777. But still has this error in redis log.
>
> I also find I cannot shutdown and restart redis. 
>
> When I type redis-server in the command line, the log info:
> [2892] 18 Feb 16:14:32.457 # Warning: no config file specified, using the 
> default config. In order to specify a config file use redis-server 
> /path/to/redis.conf
> [2892] 18 Feb 16:14:32.459 # Unable to set the max number of files limit 
> to 10032 (Operation not permitted), setting the max clients configuration 
> to 3984.
> [2892] 18 Feb 16:14:32.459 # Creating Server TCP listening socket *:6379: 
> bind: Address already in use
>
> *These are the redis processes running:*
> redis-ser  1418redis4u  IPv6  14515  0t0  TCP *:6379 (LISTEN)
> redis-ser  1418redis5u  IPv4  14516  0t0  TCP *:6379 (LISTEN)
> redis-ser  1418redis6u  IPv6 203617  0t0  TCP 
> localhost:6379->localhost:34108 (ESTABLISHED)
> redis-ser  1418redis7u  IPv6 202944  0t0  TCP 
> localhost:6379->localhost:34104 (ESTABLISHED)
>
> On Monday, February 18, 2019 at 4:14:44 PM UTC-5, flora.xia...@gmail.com 
> wrote:
>>
>> Hi,
>>
>> The real-time discussion function (supported by Daphne) on my website is 
>> not working (Other non-real-time functions are good). The console echos: 
>> "WebSocket connection to 'ws://xxxforum/room_xxx/' failed: Error during 
>> WebSocket handshake: Unexpected response code: 200". I've went through the 
>> blog posts and the documentation but couldn't find a solution. Can anyone 
>> help?
>>
>> I am attaching information that I think is needed. If you need any other 
>> information please let me know.
>>
>> *The non-real-time part is supported by uwsgi* (I know it can be 
>> supported by Daphne too. But since the real-time part is not working I 
>> decide to use uwsgi): 
>> uwsgi --socket mysite.sock --module mysite.wsgi --chmod-socket=666 
>> --processes=6
>>
>> *daphne*:
>> daphne mysite.asgi:channel_layer --port 8000 --bind 0.0.0.0 -v2 &
>> python manage.py runworker -v2 &
>>
>> *nginx configuration:*
>> upstream websocket { server 0.0.0.0:8000; } server { listen 80; 
>> server_name mysite.com; charset utf-8; client_max_body_size 20M; 
>> location /static { alias /path/to/mysite/static; } location / { include 
>> /etc/nginx/uwsgi_params;
>> uwsgi_pass unix:///path/to/mysite/mysite.sock; } location /ws { 
>> proxy_pass http://websocket; proxy_http_version 1.1; proxy_set_header 
>> Upgrade $http_upgrade;
>> proxy_set_header Connection "upgrade";
>> proxy_redirect off;
>> proxy_set_header   Host $host;
>> proxy_set_header   X-Real-IP $remote_addr;
>> proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
>> proxy_set_header   X-Forwarded-Host $server_name;
>> }
>> }
>>
>> One thing that I don't understand is that if I try to use Daphne to 
>> support both real-time and non-real-time communication by deleting the 
>> uwsgi block "location / {}" and renaming "location /ws {}" to "location / 
>> {}" the nginx service cannot be restarted. Does it suggest any bug?
>>
>> *first few lines in .js related to the discussion function:*
>> $(function() {
>> var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws"; var 
>> chatsock = new ReconnectingWebSocket(ws_scheme + '://' + 
>> window.location.host + window.location.pathname);
>> ..
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d5da9eb-ce85-4924-bd46-e28f4ed8ede0%40googlegroups.com.
For more 

Re: Websocket 200 error

2019-02-18 Thread flora . xiaoyun . huang
I am guessing maybe there is an issue with the redis-server? *The log I 
received from Daphne*:
2019-02-18 21:07:54,543 ERRORError trying to receive messages: Error 
running script (call to f_3640886a0c8901ca9188f5f7a5f7a346145b9c5f): 
@user_script:3: @user_script: 3: -MISCONF Redis is configured to save RDB 
snapshots, but is currently not able to persist on disk. Commands that may 
modify the data set are disabled. Please check Redis logs for details about 
the error.

So I check *redis log*:
[1418] 18 Feb 16:09:27.071 * 1 changes in 900 seconds. Saving...
[1418] 18 Feb 16:09:27.072 * Background saving started by pid 2834
[2834] 18 Feb 16:09:27.073 # Failed opening .rdb for saving: Permission 
denied
[1418] 18 Feb 16:09:27.172 # Background saving error

I searched ways to solve the problem and set the permission of .rdb to 777. 
But still has this error in redis log.

I also find I cannot shutdown and restart redis. 

When I type redis-server in the command line, the log info:
[2892] 18 Feb 16:14:32.457 # Warning: no config file specified, using the 
default config. In order to specify a config file use redis-server 
/path/to/redis.conf
[2892] 18 Feb 16:14:32.459 # Unable to set the max number of files limit to 
10032 (Operation not permitted), setting the max clients configuration to 
3984.
[2892] 18 Feb 16:14:32.459 # Creating Server TCP listening socket *:6379: 
bind: Address already in use

*These are the redis processes running:*
redis-ser  1418redis4u  IPv6  14515  0t0  TCP *:6379 (LISTEN)
redis-ser  1418redis5u  IPv4  14516  0t0  TCP *:6379 (LISTEN)
redis-ser  1418redis6u  IPv6 203617  0t0  TCP 
localhost:6379->localhost:34108 (ESTABLISHED)
redis-ser  1418redis7u  IPv6 202944  0t0  TCP 
localhost:6379->localhost:34104 (ESTABLISHED)

On Monday, February 18, 2019 at 4:14:44 PM UTC-5, flora.xia...@gmail.com 
wrote:
>
> Hi,
>
> The real-time discussion function (supported by Daphne) on my website is 
> not working (Other non-real-time functions are good). The console echos: 
> "WebSocket connection to 'ws://xxxforum/room_xxx/' failed: Error during 
> WebSocket handshake: Unexpected response code: 200". I've went through the 
> blog posts and the documentation but couldn't find a solution. Can anyone 
> help?
>
> I am attaching information that I think is needed. If you need any other 
> information please let me know.
>
> *The non-real-time part is supported by uwsgi* (I know it can be 
> supported by Daphne too. But since the real-time part is not working I 
> decide to use uwsgi): 
> uwsgi --socket mysite.sock --module mysite.wsgi --chmod-socket=666 
> --processes=6
>
> *daphne*:
> daphne mysite.asgi:channel_layer --port 8000 --bind 0.0.0.0 -v2 &
> python manage.py runworker -v2 &
>
> *nginx configuration:*
> upstream websocket { server 0.0.0.0:8000; } server { listen 80; 
> server_name mysite.com; charset utf-8; client_max_body_size 20M; location 
> /static { alias /path/to/mysite/static; } location / { include 
> /etc/nginx/uwsgi_params;
> uwsgi_pass unix:///path/to/mysite/mysite.sock; } location /ws { proxy_pass 
> http://websocket; proxy_http_version 1.1; proxy_set_header Upgrade 
> $http_upgrade;
> proxy_set_header Connection "upgrade";
> proxy_redirect off;
> proxy_set_header   Host $host;
> proxy_set_header   X-Real-IP $remote_addr;
> proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header   X-Forwarded-Host $server_name;
> }
> }
>
> One thing that I don't understand is that if I try to use Daphne to 
> support both real-time and non-real-time communication by deleting the 
> uwsgi block "location / {}" and renaming "location /ws {}" to "location / 
> {}" the nginx service cannot be restarted. Does it suggest any bug?
>
> *first few lines in .js related to the discussion function:*
> $(function() {
> var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws"; var 
> chatsock = new ReconnectingWebSocket(ws_scheme + '://' + 
> window.location.host + window.location.pathname);
> ..
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4886f1be-5177-405b-9b90-43603db779ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Websocket 200 error

2019-02-18 Thread flora . xiaoyun . huang
Thank you in advance!

On Monday, February 18, 2019 at 4:14:44 PM UTC-5, flora.xia...@gmail.com 
wrote:
>
> Hi,
>
> The real-time discussion function (supported by Daphne) on my website is 
> not working (Other non-real-time functions are good). The console echos: 
> "WebSocket connection to 'ws://xxxforum/room_xxx/' failed: Error during 
> WebSocket handshake: Unexpected response code: 200". I've went through the 
> blog posts and the documentation but couldn't find a solution. Can anyone 
> help?
>
> I am attaching information that I think is needed. If you need any other 
> information please let me know.
>
> *The non-real-time part is supported by uwsgi* (I know it can be 
> supported by Daphne too. But since the real-time part is not working I 
> decide to use uwsgi): 
> uwsgi --socket mysite.sock --module mysite.wsgi --chmod-socket=666 
> --processes=6
>
> *daphne*:
> daphne mysite.asgi:channel_layer --port 8000 --bind 0.0.0.0 -v2 &
> python manage.py runworker -v2 &
>
> *nginx configuration:*
> upstream websocket { server 0.0.0.0:8000; } server { listen 80; 
> server_name mysite.com; charset utf-8; client_max_body_size 20M; location 
> /static { alias /path/to/mysite/static; } location / { include 
> /etc/nginx/uwsgi_params;
> uwsgi_pass unix:///path/to/mysite/mysite.sock; } location /ws { proxy_pass 
> http://websocket; proxy_http_version 1.1; proxy_set_header Upgrade 
> $http_upgrade;
> proxy_set_header Connection "upgrade";
> proxy_redirect off;
> proxy_set_header   Host $host;
> proxy_set_header   X-Real-IP $remote_addr;
> proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header   X-Forwarded-Host $server_name;
> }
> }
>
> One thing that I don't understand is that if I try to use Daphne to 
> support both real-time and non-real-time communication by deleting the 
> uwsgi block "location / {}" and renaming "location /ws {}" to "location / 
> {}" the nginx service cannot be restarted. Does it suggest any bug?
>
> *first few lines in .js related to the discussion function:*
> $(function() {
> var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws"; var 
> chatsock = new ReconnectingWebSocket(ws_scheme + '://' + 
> window.location.host + window.location.pathname);
> ..
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2bf2a20d-2650-49e6-a9e3-f0602b498a0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.