コード例 #1
0
    // Use this for initialization
    public void Start()
    {
        TrafficUpdate t       = new TrafficUpdate(101, 1);
        string        message = t.toJson();

        Console.WriteLine(message);
        var body = Encoding.UTF8.GetBytes(message);

        channel.BasicPublish(exchange: "",
                             routingKey: commandqueue,
                             basicProperties: null,
                             body: body);
    }
コード例 #2
0
 // Update is called once per frame
 public void Update()
 {
     if (tempTime + 5 < DateTime.Now.Second && this.sendResponse)
     {
         TrafficUpdate t       = new TrafficUpdate(101, 0);
         string        message = t.toJson();
         Console.WriteLine(message);
         var body = Encoding.UTF8.GetBytes(message);
         channel.BasicPublish(exchange: "",
                              routingKey: commandqueue,
                              basicProperties: null,
                              body: body);
         this.sendResponse = false;
     }
 }