Comments (4)
配置文件贴一下
from tsrpc.
#user root;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 102400;
accept_mutex on;
multi_accept on;
#use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
access_log off;
sendfile on;
tcp_nopush on;
keepalive_timeout 55;
tcp_nodelay on;
client_header_buffer_size 4k;
client_body_buffer_size 512k;
open_file_cache max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
client_header_timeout 15;
client_body_timeout 15;
reset_timedout_connection on;
send_timeout 15;
server_tokens off;
client_max_body_size 50m;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6].";
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name localhost;
#static file
location /{
root "D:/Program Files/Nginx/nginx-1.16.1/html/";
index index.html;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
}
location /niudu{
proxy_pass http://localhost:8887;
}
location /fish{
proxy_pass http://localhost:8890;
}
location /userApi{
proxy_pass http://localhost:8080;
}
location /matchApi{
proxy_pass http://localhost:8081;
}
location /roomApi{
proxy_pass http://localhost:8082;
}
location /user {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection keep-alive;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /match {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection keep-alive;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /room {
proxy_pass http://127.0.0.1:3002;
proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_redirect off;
proxy_set_header Connection keep-alive;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~* .(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {
ssi on;
ssi_silent_errors on;
root "D:/Program Files/Nginx/nginx-1.16.1/html/";
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
#index index1.html;
#cache
expires 7d;
}
}
}
from tsrpc.
<17816> 2022-10-19 19:46:10 [INFO] ::1 #1275 [Api:matchAdmin/RoomServerJoin] [ApiReq] { serverUrl: 'ws://127.0.0.1/match' }
<17816> 2022-10-19 19:46:10 [INFO] RS|ws://127.0.0.1/match TSRPC WebSocket Client : ws://127.0.0.1/match
<17816> 2022-10-19 19:46:10 [INFO] RS|ws://127.0.0.1/match Start connecting ws://127.0.0.1/match...
<17816> 2022-10-19 19:46:10 [INFO] RS|ws://127.0.0.1/match WebSocket connection to server successful
<17816> 2022-10-19 19:46:10 [INFO] RS|ws://127.0.0.1/match [ApiReq] #1 roomAdmin/Auth { type: 'MatchServer', token: '' }
匹配服务有连接被断开
<17816> 2022-10-19 19:46:10 [INFO] RS|ws://127.0.0.1/match Lost connection to ws://127.0.0.1/match code=1000 reason=Invalid request buffer, please check the version of service proto.
<17816> 2022-10-19 19:46:10 [ERROR] RS|ws://127.0.0.1/match [ApiErr] #1 roomAdmin/Auth TsrpcError {
message: 'Invalid request buffer, please check the version of service proto.',
type: 'NetworkError',
code: 'LOST_CONN'
}
<17816> 2022-10-19 19:46:10 [ERROR] ::1 #1275 [Api:matchAdmin/RoomServerJoin] [ApiErr] 18ms TsrpcError {
message: 'Invalid request buffer, please check the version of service proto.',
type: 'NetworkError',
code: 'LOST_CONN'
} req= { serverUrl: 'ws://127.0.0.1/match' }
这个是其中的一个打印日志
from tsrpc.
不好意思 问题找到了 是websocket连接的url地址 和发送的消息协议 不是同一个 也就是连接的匹配服务url 然后用了房间服务的serviceProto 发送了房间服务的消息内容 感谢作者您写的开源tsrpc 用起来很方便
from tsrpc.
Related Issues (20)
- 类型定义问题 HOT 2
- gRPC compatibility HOT 1
- 项目打包时报错:no such file or directory, open 'dist/package.json' HOT 1
- npm run sync错误 HOT 3
- Question: 对比近两年新出的 tRPC 项目 HOT 1
- 联机游戏的后端如何使用cocos的物理引擎 HOT 2
- 在TSRPC中使用export default interface导出接口后,npm run doc会报错
- 习惯断点调试,不知道vscode能不能操作 HOT 1
- 是否支持修改 ApiReturnSucc/ApiReturnError 的类型? HOT 1
- 请问如何让http和websocket使用同一端口 HOT 2
- npm test报错
- 看了您TSRPC + Cocos,多人实时对战 So Easy!的文章,请教俩个问题。 HOT 3
- how this project relate/refer to tRPC HOT 1
- cocos creator 3.7.2无法使用 HOT 3
- ws和http如何共存 HOT 7
- 是否支持ChatGPT的流式传输? HOT 1
- server的实现是基于什么语言/框架?
- 希望能提供侦听的 ip 的设置,阿里云的 函数计算 3.0 中有一段说明,说是必须侦听 '0.0.0.0:port' 或 '*:port'
- 可以和 unity puerts 一起用吗? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsrpc.