Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom / advanced event types. #15

Open
MengelCode opened this issue Mar 29, 2020 · 1 comment
Open

Custom / advanced event types. #15

MengelCode opened this issue Mar 29, 2020 · 1 comment

Comments

@MengelCode
Copy link

We have the events connection, pre-disconnection and disconnection.
Is it planned to give a user a way to add custom / more advanced types of events?
I think of events such as:

*A message / data packet with specific content received, treat it elsewhere different from everything else.

  • TCP connection still persists, but the last data packet received was some time ago, treat this case, e.g. with sending a "ping" (and hopefully receiving a "pong").
  • Connection to other side lost (as a special case of disconection).
@jhg023
Copy link
Owner

jhg023 commented Mar 29, 2020

@Mengel38 I'm open to adding events of other types.

However, I'm not a fan of an event that searches for data containing specific content. You can already achieve this by assigning opcodes to data that you send. When a specific opcode is received, special processing can be performed. I have an example of this in the README.

Currently, you also have the ability to track and update the last time a Client received any data from the Server by using an IdentityHashMap<Client, Instant>.

Regarding an event that would fire if a Client unexpectedly lost connection to the Server, I think is a reasonable request. I'll look into adding this soon.

Thanks for your suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants