Skip to content

feat(example-mqtt): new MQTT heartBeat broker and client examples#9336

Merged
normanmaurer merged 6 commits intonetty:4.1from
RobinGG:4.1
Jul 10, 2019
Merged

feat(example-mqtt): new MQTT heartBeat broker and client examples#9336
normanmaurer merged 6 commits intonetty:4.1from
RobinGG:4.1

Conversation

@RobinGG
Copy link
Copy Markdown
Contributor

@RobinGG RobinGG commented Jul 8, 2019

Motivation:

Recently I'm going to build MQTT broker and client based on Netty. I had MQTT encoder and decoder founded, while no basic examples. So I'm going to share my simple heartBeat MQTT broker and client as an example.

Modification:

New MQTT heartBeat example under io.netty.example/mqtt/heartBeat/.

Result:

Client would send CONNECT and PINGREQ(heartBeat message).

  • CONNECT: once channel active
  • PINGREQ: once IdleStateEvent triggered, which is 20 seconds in this example
    Client would discard all messages it received.
    MQTT broker could handle CONNECT, PINGREQ and DISCONNECT messages.
  • CONNECT: send CONNACK back
  • PINGREQ: send PINGRESP back
  • DISCONNECT: close the channel
    Broker would close the channel if 2 heartBeat lost, which set to 45 seconds in this example.

@netty-bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this please

@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this please

@normanmaurer normanmaurer requested a review from njhill July 8, 2019 20:06
Copy link
Copy Markdown
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Just one minor comment

@normanmaurer
Copy link
Copy Markdown
Member

@netty-bot test this please

@normanmaurer normanmaurer added this to the 4.1.38.Final milestone Jul 10, 2019
@normanmaurer normanmaurer merged this pull request into netty:4.1 Jul 10, 2019
@normanmaurer
Copy link
Copy Markdown
Member

Cherry-picked as b02ee11... Thanks!

normanmaurer pushed a commit that referenced this pull request Jul 10, 2019
)

Motivation:

Recently I'm going to build MQTT broker and client based on Netty. I had MQTT encoder and decoder founded, while no basic examples. So I'm going to share my simple heartBeat MQTT broker and client as an example.

Modification:

New MQTT heartBeat example under io.netty.example/mqtt/heartBeat/.

Result:

Client would send CONNECT and PINGREQ(heartBeat message).
  - CONNECT: once channel active
  - PINGREQ: once IdleStateEvent triggered, which is 20 seconds in this example
Client would discard all messages it received.
MQTT broker could handle CONNECT, PINGREQ and DISCONNECT messages.
  - CONNECT: send CONNACK back
  - PINGREQ: send PINGRESP back
  - DISCONNECT: close the channel
Broker would close the channel if 2 heartBeat lost, which set to 45 seconds in this example.
normanmaurer pushed a commit that referenced this pull request Jul 10, 2019
)

Motivation:

Recently I'm going to build MQTT broker and client based on Netty. I had MQTT encoder and decoder founded, while no basic examples. So I'm going to share my simple heartBeat MQTT broker and client as an example.

Modification:

New MQTT heartBeat example under io.netty.example/mqtt/heartBeat/.

Result:

Client would send CONNECT and PINGREQ(heartBeat message).
  - CONNECT: once channel active
  - PINGREQ: once IdleStateEvent triggered, which is 20 seconds in this example
Client would discard all messages it received.
MQTT broker could handle CONNECT, PINGREQ and DISCONNECT messages.
  - CONNECT: send CONNACK back
  - PINGREQ: send PINGRESP back
  - DISCONNECT: close the channel
Broker would close the channel if 2 heartBeat lost, which set to 45 seconds in this example.
@RobinGG
Copy link
Copy Markdown
Contributor Author

RobinGG commented Jul 10, 2019

It was my pleasure, and thanks for your and Nick's kindly help!

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

Successfully merging this pull request may close these issues.

4 participants