Skip to content

Commit

Permalink
Add constructor accepting string
Browse files Browse the repository at this point in the history
  • Loading branch information
spuun committed Oct 24, 2024
1 parent 4b86ea3 commit 5f8ae55
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mqtt/protocol/payload.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module MQTT
BytesPayload.new(bytes)
end

def self.new(str : String)
BytesPayload.new(str.to_slice)
end

def self.new(io : ::IO, bytesize : Int32)
IOPayload.new(MQTT::Protocol::IO.new(io), bytesize)
end
Expand Down

0 comments on commit 5f8ae55

Please sign in to comment.