Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Pike Module Reference:

module version 1.2, prepared

  MODULE Public
Modules
Protocols

  MODULE Public.Protocols
Modules
MQTT

  MODULE Public.Protocols.MQTT
Modules
Protocols

  MODULE Public.Protocols.MQTT.Protocols
Modules
MQTT

  MODULE Public.Protocols.MQTT.Protocols.MQTT
Classes
MQTTServer
Message
client
protocol

Description

MQTT v3.1 support

  CLASS Public.Protocols.MQTT.Protocols.MQTT.MQTTServer
Methods
create()
create()
set_connection_program()
set_port_program()
start()

Method create

void Public.Protocols.MQTT.Protocols.MQTT.MQTTServer()->create(int port)


Method create

void Public.Protocols.MQTT.Protocols.MQTT.MQTTServer()->create(int port, string address)


Method set_connection_program

void Public.Protocols.MQTT.Protocols.MQTT.MQTTServer()->set_connection_program(program conn_program)

Description

specify the server connection program to be used when accepting new connections.


Method set_port_program

void Public.Protocols.MQTT.Protocols.MQTT.MQTTServer()->set_port_program(function(void : object(Stdio.Port))|program port_factory)

Description

specify a port program to be used when starting the server.


Method start

void Public.Protocols.MQTT.Protocols.MQTT.MQTTServer()->start()

Description

bind to the specified port and enable the server

  CLASS Public.Protocols.MQTT.Protocols.MQTT.Message
Methods
decode_body()

Method decode_body

void Public.Protocols.MQTT.Protocols.MQTT.Message()->decode_body(object(Stdio.Buffer) body)

Description

decode both the variable_header (if any) and payload (if any)

  CLASS Public.Protocols.MQTT.Protocols.MQTT.client
Methods
connect()
connect()
create()
create()
publish_sync()
send_message()
set_disconnect_callback()
set_will_and_testament()
subscribe()
unsubscribe()
Description

MQTT client


Method connect

void Public.Protocols.MQTT.Protocols.MQTT.client()->connect(function(object(.client) : void) _connect_cb)

Description

connect and specify a method to be called when the connection successfully completes.


Method connect

void Public.Protocols.MQTT.Protocols.MQTT.client()->connect()

Description

connect to the server.

Note

this method may return before the connection has succeeded or failed.


Method create

void Public.Protocols.MQTT.Protocols.MQTT.client()->create(string _host, int _port)

Description

create a client which will connect to an mqtt server on the specified server and port.


Method create

void Public.Protocols.MQTT.Protocols.MQTT.client()->create(string _connect_url)

Description

create a client

Parameter _connect_url

A url in the form of mqtt://[user[:password]@][hostname][:port] or mqtts://[user[:password]@][hostname][:port]


Inherit protocol

  • .protocol

  • Method publish_sync

    void Public.Protocols.MQTT.Protocols.MQTT.client()->publish_sync(string topic, string msg, int|void qos_level)

    Description

    publish a message synchronously and if QOS level requires a response, wait before returning.

    Note

    synchronous publishing is far slower than asynchnronous publishing using publish.


    Method send_message

    void Public.Protocols.MQTT.Protocols.MQTT.client()->send_message(object(.Message) m)

    Description

    method used internally by the MQTT client


    Method set_disconnect_callback

    void Public.Protocols.MQTT.Protocols.MQTT.client()->set_disconnect_callback(function(object(.client), object(.Reason) : void) cb)

    Description

    specify a callback to be run when a client is disconnected.


    Method set_will_and_testament

    void Public.Protocols.MQTT.Protocols.MQTT.client()->set_will_and_testament(string topic, string message, int(0..2) qos)

    Description

    specify the will and testament message that will be sent by the server when this client disconnects.


    Method subscribe

    void Public.Protocols.MQTT.Protocols.MQTT.client()->subscribe(string topic, function(object(.client), string, string : void) publish_cb)

    Description

    subscribe to a topic at the qos level specified by set_qos_level().

    Parameter publish_cb

    a method which will be called for each message received. parameters include the MQTT client, the topic and the message body.

    Note

    multiple subscriptions to a given topic may be made by calling this method repeatedly with different callback methods.


    Method unsubscribe

    void Public.Protocols.MQTT.Protocols.MQTT.client()->unsubscribe(string topic, function(object(.client), string, string : void) publish_cb)

    Description

    unsubscribe the specified publish callback from a topic. If all callbacks registered for a topic have been removed, the client will unsubscribe from the topic

      CLASS Public.Protocols.MQTT.Protocols.MQTT.protocol
    Methods
    disconnect()
    get_client_identifier()
    get_will_message()
    get_will_qos()
    get_will_topic()
    is_connected()
    publish()
    set_client_identifier()
    set_publish_response_timeout()
    set_qos_level()
    set_response_timeout()
    set_retry_attempts()
    set_ssl_context()

    Method disconnect

    void Public.Protocols.MQTT.Protocols.MQTT.protocol()->disconnect()


    Method get_client_identifier

    string Public.Protocols.MQTT.Protocols.MQTT.protocol()->get_client_identifier()


    Method get_will_message

    string Public.Protocols.MQTT.Protocols.MQTT.protocol()->get_will_message()


    Method get_will_qos

    int(0..2) Public.Protocols.MQTT.Protocols.MQTT.protocol()->get_will_qos()


    Method get_will_topic

    string Public.Protocols.MQTT.Protocols.MQTT.protocol()->get_will_topic()


    Method is_connected

    int Public.Protocols.MQTT.Protocols.MQTT.protocol()->is_connected()


    Method publish

    void Public.Protocols.MQTT.Protocols.MQTT.protocol()->publish(string topic, string msg, int|void qos_level, function failure_cb)

    Description

    publish a message and return immediately.

    Note

    all I/O performed by this message happens in the backend, so any code that calls this method must return to the backend before any work is done.


    Method set_client_identifier

    void Public.Protocols.MQTT.Protocols.MQTT.protocol()->set_client_identifier(string id)


    Method set_publish_response_timeout

    void Public.Protocols.MQTT.Protocols.MQTT.protocol()->set_publish_response_timeout(int secs)

    Description

    the seconds to wait for a response from the server for acknowledged publish requests

    as published messages could be larger and require more time to transmit, this timeout is configurable seprately from the acknowledged request timeout used by subscribe and unsubscribe messages.


    Method set_qos_level

    void Public.Protocols.MQTT.Protocols.MQTT.protocol()->set_qos_level(int(0..2) level)

    Description

    sets the QOS level for all subscriptions on this client


    Method set_response_timeout

    void Public.Protocols.MQTT.Protocols.MQTT.protocol()->set_response_timeout(int secs)

    Description

    the seconds to wait for a response from the server for acknowledged requests


    Method set_retry_attempts

    void Public.Protocols.MQTT.Protocols.MQTT.protocol()->set_retry_attempts(int count)

    Description

    number of times to retry transmission for requests whose acknowledgements have timed out


    Method set_ssl_context

    void Public.Protocols.MQTT.Protocols.MQTT.protocol()->set_ssl_context(object(SSL.Context) context)

    gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University