Comments (4)
Each web socket connection is for specific user. And your server has these handles. You could set up a queue based on say REMOTE_ADDR etc. But I would use something that is unique to user. More than one user can share the same IP behind the NAT.
from lua-resty-websocket.
Thanks for reply.
So am i right that i can get somewhere source IP of each user that connecting to websocket server
like ngx.source_ip() or something like this?
from lua-resty-websocket.
@ovoshlook, of course, you may grap it from a normal nginx variable ngx.var.remote_addr
, but I wouldn't use it. You should at least check for reverse proxies, e.g.: https://github.com/bungle/lua-resty-session/blob/master/lib/resty/session.lua#L235-L252 (session module btw. doesn't check address by default because of many problems it might cause - but in a controlled environment, it is okay).
from lua-resty-websocket.
使用ngx.semaphore可以完成对应功能
from lua-resty-websocket.
Related Issues (20)
- websocket client example HOT 1
- [alert] 3422#0: worker process 4444 exited on signal 11 (core dumped)? HOT 3
- Errors in use with lua-resty-http HOT 2
- bad RSV1, RSV2, or RSV3 bits HOT 1
- Tests are failing on ppc64le
- unexpected connection behavior
- Compilation errors while running sample programs https://github.com/openresty/lua-resty-websocket HOT 4
- RFC 8441 support: WebSockets over h2, h2c
- Run Autobahn Testsuite
- maybe it is websocket client issue or wrong way to use HOT 1
- webscoekt建立连接后收到后端返回的数据帧被截断,只有32k HOT 1
- lj_str_new
- how to access websocket clients / handles from websocket server?
- can not use resty redis HOT 1
- use websocket client to sync data in local redis before nginx is accessible HOT 5
- "send_text" got no error meesage after browser closed HOT 1
- [idea] support HTTP connection reuse HOT 4
- bad RSV1, RSV2, or RSV3 bits
- ssl session repeated sslhandshake HOT 2
- websocket ratelimiting
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 lua-resty-websocket.