node-pinus / pinus

A fast,scalable,distributed game server framework for Node.js, Powered by TypeScript. 一个TypeScript写的node.js分布式游戏/应用服务器框架(原型基于pomelo)。
https://pinus.io
MIT License
1.83k stars 377 forks source link

pinus 服务端的 session 调用偶尔会丢 uid 的值咋回事,大家遇到过吗? #938

Open zoujiaqing opened 2 months ago

zoujiaqing commented 2 months ago

从日志中可以看出我第一次打印 session.remoteAddress.ip 和 session.uid 都是成功的,后面请求的时候 session.uid 丢了,可能是啥原因呢?

[2024-08-14T01:49:14.509] [INFO] logger - 5: [gate-server-1 console] uid >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Wed Aug 14 2024 01:49:14 GMT+0800 (CST)
[2024-08-14T01:49:14.510] [INFO] logger - 44: [gate-server-1 console] ip: 47.116.98.172 , port: 3050
[2024-08-14T01:49:15.576] [INFO] logger - 18: [connector-server-1 console] session.remoteAddress.ip .................................... >>>
[2024-08-14T01:49:15.577] [INFO] logger - 20: [connector-server-1 console] "::ffff:113.249.234.12"
[2024-08-14T01:49:15.578] [INFO] logger - 5: [connector-server-1 console] uid >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 24
[2024-08-14T01:49:15.595] [INFO] logger - 74: [hall-server-1 console] connected
[2024-08-14T01:49:15.820] [INFO] logger - 18: [connector-server-1 console] session.remoteAddress.ip .................................... >>>
[2024-08-14T01:49:15.821] [INFO] logger - 20: [connector-server-1 console] "::ffff:113.249.234.12"
[2024-08-14T01:49:15.822] [INFO] logger - 5: [connector-server-1 console] uid >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> null
zoujiaqing commented 2 months ago

不排除是客户端问题,因为 ios 请求没问题,android 有问题,但是 ts 代码都是一模一样。

代码如下:


        var route = 'hall.hallHandler.enter';
        var res: IResponse = await vv.pinus.request(route, {});
whtiehack commented 2 months ago

你把sessionId也打印出来.看是不是 sessionid变了

zoujiaqing commented 2 months ago

这个错误后来没解决,但是客户端代码是一套,不知道咱们这个 cocoscreator 可以整合 pinus 的最新 TS 代码和实例有没有呢?

whtiehack commented 1 month ago

就js代码就行 了 我也没有ts的