GithubHelp home page GithubHelp logo

Comments (4)

bungle avatar bungle commented on June 18, 2024

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.

ovoshlook avatar ovoshlook commented on June 18, 2024

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.

bungle avatar bungle commented on June 18, 2024

@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.

ouyangruoxue avatar ouyangruoxue commented on June 18, 2024

使用ngx.semaphore可以完成对应功能

from lua-resty-websocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.