LiberalStomp.php

Summary
LiberalStomp.php
LiberalSTOMPLiberal STOMP interface implementation
LiberalStomp
getSocketWe need to be able to get the socket so advanced daemons can do a select() waiting for input both from the queue and from other sources such as an XMPP connection.
getServerReturn the host we’re currently connected to.
_makeConnectionMake socket connection to the server We also set the stream to non-blocking mode, since we’ll be select’ing to wait for updates.
readFramesVersion 1.0.0 of the Stomp library gets confused if messages come in too fast over the connection.
parseFrameParse a raw Stomp frame into an object.
_writeFrameWrite frame to server

LiberalSTOMP

Liberal STOMP interface implementation

postActiv

the micro-blogging software

Copyright

Copyright © 2016-2017, Maiyannah Bishop

Derived from code copyright various sources

  • GNU Social © 2013-2016, Free Software Foundation, Inc
  • StatusNet © 2008-2012, StatusNet, Inc

License

This file is subject to a different license than most of postActiv.

Original code is copyright 2005-2006 The Apache Software Foundation Modifications copyright 2009 StatusNet Inc by Brion Vibber Documentation copyright 2016-2017 Maiyannah Bishop

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License.

https://www.gnu.org/licenses/agpl.html

About

Liberal STOMP interface implementation

Based on code from Stomp PHP library, working around bugs in the base class.

PHP version

Tested with PHP 7

File Authors

Web

LiberalStomp

Summary
getSocketWe need to be able to get the socket so advanced daemons can do a select() waiting for input both from the queue and from other sources such as an XMPP connection.
getServerReturn the host we’re currently connected to.
_makeConnectionMake socket connection to the server We also set the stream to non-blocking mode, since we’ll be select’ing to wait for updates.
readFramesVersion 1.0.0 of the Stomp library gets confused if messages come in too fast over the connection.
parseFrameParse a raw Stomp frame into an object.
_writeFrameWrite frame to server

getSocket

function getSocket()

We need to be able to get the socket so advanced daemons can do a select() waiting for input both from the queue and from other sources such as an XMPP connection.

Returns

  • resource

getServer

function getServer()

Return the host we’re currently connected to.

Returns

  • string

_makeConnection

protected function _makeConnection ()

Make socket connection to the server We also set the stream to non-blocking mode, since we’ll be select’ing to wait for updates.  In blocking mode it seems to get confused sometimes.

Error State

  • Throws a StompException if it cannot connect

readFrames

Version 1.0.0 of the Stomp library gets confused if messages come in too fast over the connection.  This version will read out as many frames as are ready to be read from the socket.

Modified from Stomp::readFrame()

Returns

  • StompFrame False when no frame to read

parseFrame

function parseFrame($data)

Parse a raw Stomp frame into an object.  Extracted from Stomp::readFrame()

Parameters

  • string $data

Returns

  • StompFrame

_writeFrame

protected function _writeFrame (StompFrame $stompFrame)

Write frame to server

Parameters

  • StompFrame $stompFrame
function getSocket()
We need to be able to get the socket so advanced daemons can do a select() waiting for input both from the queue and from other sources such as an XMPP connection.
function getServer()
Return the host we’re currently connected to.
protected function _makeConnection ()
Make socket connection to the server We also set the stream to non-blocking mode, since we’ll be select’ing to wait for updates.
function parseFrame($data)
Parse a raw Stomp frame into an object.
protected function _writeFrame (StompFrame $stompFrame)
Write frame to server