<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Runtime Configuration</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sam.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="sam.resources.html">Resource Types</a></div> <div class="up"><a href="sam.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="sam.configuration" class="section"> <h2 class="title">Runtime Configuration</h2> <div class="section" id="sam.configuration.mapping"> <h2 class="title">Protocol support and mapping</h2> <p class="para"> The SAM framework can be extended to support other messaging protocols and connection mechanisms. To add support for a new protocol or connection library a support class has to be defined, either as a C extension or as a PHP script, and a "factory" script must be created. The support class must implement all the methods of the SAMConnection class though it should not inherit from SAMConnection. The factory script will be called by the SAM framework to create an instance of the implemented class. The way SAM chooses which factory to call is based on the protocol specified as the first parameter of the "connect" call. </p> <p class="para"> By default the built-in MQTT support will be used if a connect call specifies a protocol of SAM_MQTT ("mqtt"), for any other protocol SAM will attempt to use the XMS support extension. To add support for additional protocols or to modify the default behavior entries may be added to <var class="filename">php.ini</var> in the [sam] section. The default mapping is equivalent to the following entries: <div class="example-contents screen"> <div class="cdata"><pre> [sam] sam.factory.mqtt=mqtt sam.factory.wmq=xms sam.factory.wmq:client=xms sam.factory.wmq:bindings=xms sam.factory.wpm=xms sam.factory.rtt=xms </pre></div> </div> As can be seen from these examples the entries take the form of "sam.factory.pppp=xxx" where pppp is the protocol string specified on the connect call and xxx is a factory suffix. Note: SAM defines constants for these protocol strings such that <em>SAM_WMQ=wmq</em>, <em>SAM_WPM=wpm</em>, <em>SAM_RTT=rtt</em>, <em>SAM_MQTT=mqtt</em>, etc. </p> <p class="para"> When identifying the support code to use on a connect call SAM looks up the protocol name in the <var class="filename">php.ini</var> entries and then invokes a factory script named <var class="filename">sam_factory_xxx.php</var>. If no entry is found the support will default to XMS. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sam.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="sam.resources.html">Resource Types</a></div> <div class="up"><a href="sam.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>