I currently have a server built using Netty/MySQL which I'm in the process of optimizing. It's incredibly simple, essentially does the following:
- Accepts persistent connections
- Makes database queries on behalf of the client (depending on client message and authorization)
- Updates state of client (right now with local variables per client/channel- i.e. "numberOfQueriesMadeForThisClientSession")
- Forces disconnects based on database, authentication and knowledge of other clients (i.e. if clientA is connected and clientB sends a special command, if verified by server, clientA is disconnected)
- Reacts to disconnects (updates database, etc.)
- Checks aes-encrypted content
However, I'm a little worried about the type of things that can happen with scaling... for example maybe handling timeout disconnects gracefully rather than user actually quiting or forced disconnects, race conditions, etc. etc.
Odds are pubnub has thought about this stuff with more tests than myself... so I'm wondering- what would be the basic structure to migrate my netty/mysql server to use pubnub? At a glance, it seems to me like pubnub is a pure message relay without any database or business logic processing...?
Language of choice is PHP but at this point I'm most interested in the basic architecture