小编Dic*_*A S的帖子

NGINX 反向代理总是在 1 分钟后打开互联网连接关闭 websocket

nginx -V 输出

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
Run Code Online (Sandbox Code Playgroud)

NGINX 配置

upstream websocknodes{
 server 192.168.1.2:7070; 
}
location /mywebsocket/server {
    proxy_pass http://192.168.1.2:7070/mywebsocket/server;
    tcp_nodelay on;
    proxy_redirect off;
    proxy_next_upstream error timeout;
    proxy_connect_timeout 2;
    proxy_read_timeout 300s; …
Run Code Online (Sandbox Code Playgroud)

android reverse-proxy nginx websocket

6
推荐指数
0
解决办法
2690
查看次数

google chrome navigator onLine始终如一

基于Mozilla开发人员网络

https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine

它说

返回浏览器的在线状态.该属性返回一个布尔值,其中true表示在线,false表示离线.只要浏览器连接到网络的能力发生变化,该属性就会发送更新.当用户跟踪链接或脚本请求远程页面时,会发生更新.例如,当用户在失去互联网连接后立即点击链接时,该属性应返回false.

但是,当我拉网线并单击一个按钮然后放入

console.log(window.navigator.onLine)
Run Code Online (Sandbox Code Playgroud)

它仍然回归 true

这是否意味着Google Chrome还没有完全实现该技术?

javascript offline google-chrome

6
推荐指数
1
解决办法
998
查看次数

Bash 提取三位数版本的第一个数字

我想提取数1010.3.0用于Makefile添加特定CFLAGS
下面的代码只打印1030

echo "gcc.exe (Rev5, Built by MSYS2 project) 10.3.0"|sed -r 's/.* ([0-9])/\1/g' | sed -r 's/\.//g'
1030
Run Code Online (Sandbox Code Playgroud)

如何获得 10

awk sed

5
推荐指数
1
解决办法
113
查看次数

IOS是否会增加推送通知徽章编号?

我需要编写一个可以在图标上显示徽章编号的应用程序.

我能够收到推送通知,徽章编号也显示为5.

但是,当应用程序尚未启动时收到第二个推送通知时,徽章仍会显示5.

它不应该是10?

push-notification badge ios

2
推荐指数
1
解决办法
9289
查看次数

在QT5中找不到cygwin中的Qmake

我试图在cygwin中安装QT5并成功.我也正在Cygwin/X为设计师提供Xorg菜单.

但我找不到QT5的qmake.exe.我只在cygwin选择包窗口中获得以下文件

并且还表示mingw64-xxxx-qt4-qmake.exeqmake.exe

不幸的是,我无法牺牲cygwin并进行Windows分发.我应该从源代码构建Qt5吗?

cygwin qmake qt5

2
推荐指数
1
解决办法
2484
查看次数

从C#程序连接基于node.js的socket.io WebSocket服务器

我需要从C#windows窗体代码连接基于Node.js的WebSocket

节点模块使用https://github.com/Automattic/socket.io

我正在使用superwebsocket和WebSocket4Net

using SuperSocket.Common;
using SuperSocket.SocketBase;
using SuperSocket.SocketBase.Config;
using SuperSocket.SocketBase.Logging;
using SuperWebSocket;
using SuperWebSocket.SubProtocol;
using WebSocket4Net;

......
......

WebSocket webSocketClient = new WebSocket("ws://localhost:8080/");
webSocketClient.Error += new EventHandler<SuperSocket.ClientEngine.ErrorEventArgs>(webSocketClient_Error);
webSocketClient.AllowUnstrustedCertificate = true;
webSocketClient.Opened += new EventHandler(webSocketClient_Opened);
webSocketClient.Closed += new EventHandler(webSocketClient_Closed);
webSocketClient.MessageReceived += new EventHandler<MessageReceivedEventArgs>(webSocketClient_MessageReceived);
webSocketClient.Open();
Run Code Online (Sandbox Code Playgroud)

但只有webSocketClient_Error回调始终触发,任何人都可以帮忙吗?

c# websocket node.js socket.io websocket4net

1
推荐指数
1
解决办法
2896
查看次数