To import the opApi
namespace, first add a reference to the assembly, opApi.net.dll
.
Open
opClientConnection api = new opClientConnection();
api.open("127.0.0.1", 60000)
opClientConnection api = new opClientConnection("127.0.0.1", 60000);
SendRequest
string serviceId = 'getBrokerIdentity';
string requestJson = '{}';
string guid;
guid = api.sendRequest(serviceId, requestJson);
ReceiveReply
string replyJson;
replyJson = api.receiveReply(guid, 100);
DeleteRequest
SendRecvDelete
replyJson = api.sendRecvDelete(serviceId, requestJson, 100);
Close
Status Callback
namespace opConsole
{
class Program
{
static void Main(string[] args)
{
opClientConnection op = new opClientConnection("127.0.0.1", 60000);
op.statusEvent += op_statusEvent;
}
static void op_statusEvent(object sender, opClientConnection.statusEventArgs e)
{
Console.WriteLine("The status of id {0} is {1}.", e.id, e.status);
}
}
}