<div>I've put up a first pass at a design for the server/client communication classes for MoleQueue here:</div><div><br></div><a href="http://wiki.openchemistry.org/MoleQueue_JSON-RPC_Implementation">http://wiki.openchemistry.org/MoleQueue_JSON-RPC_Implementation</a><div>
<br></div><div>The MoleQueueClient and JobRequest classes will be put into a separate library that a client (e.g. Avogadro) can link to. The client will obtain a JobRequest from a MoleQueueClient instance and set the job options on the JobRequest object. The client then asks MoleQueueClient to submit the request, which passes the JobRequest object to a JsonRpc class which generates the JSON snippet for the request and returns a QByteArray. The Client the passes the QByteArray to the LocalSocket.</div>
<div><br></div><div>This pattern is used to generate all requests/notifications:</div><div><br></div><div>1. MoleQueue[Client|Server] receives request from user</div><div>2. MQ[C|S] passes request info to JsonRpc class to generate QByteArray</div>
<div>3. MQ[C|S] QByteArray is passed to QLocalSocket</div><div><br></div><div>Reception of message is handled using the following design:</div><div><br></div><div>1. QLocalSocket informs MQ[C|S] of a new packet</div><div>
2. MQ[C|S] passes packet to</div><div>QVector<unsigned long> MoleQueue::JsonRpc::interpretIncoming(const QByteArray &);</div><div>This function returns the JSON-RPC id. A vector is used so we can support batch requests.</div>
<div>3. The JsonRpc class interprets and identifies the packet, then emits a signal that is unique to the packet type with Qt-friendly arguments describing the packet contents.</div><div>4. The MQ[C|S] listens for the slots and acts appropriately on them.</div>
<div><br></div><div>Sound good?</div><div><br></div><div>Dave</div>