-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pass connection throgh broker and use session for connack
- Loading branch information
1 parent
2497723
commit cb77ee8
Showing
8 changed files
with
133 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
module LavinMQ | ||
module MQTT | ||
class Broker | ||
|
||
def connected(client) : MQTT::Session | ||
session = Session.new(client.vhost, client.client_id) | ||
session.connect(client) | ||
session | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
module LavinMQ | ||
module MQTT | ||
class Session < Queue | ||
def initialize(@vhost : VHost, @name : String, @exclusive = true, @auto_delete = false, arguments : ::AMQ::Protocol::Table = AMQP::Table.new) | ||
def initialize(@vhost : VHost, | ||
@name : String, | ||
@exclusive = true, | ||
@auto_delete = false, | ||
arguments : ::AMQ::Protocol::Table = AMQP::Table.new) | ||
super | ||
end | ||
|
||
#if sub comes in with clean_session, set auto_delete on session | ||
#rm_consumer override for clean_session | ||
|
||
#TODO: implement subscribers array and session_present? and send instead of false | ||
def connect(client) | ||
client.send(MQTT::Connack.new(false, MQTT::Connack::ReturnCode::Accepted)) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters