Ejemplo n.º 1
0
        public HttpResponseMessage Send()
        {
            try
            {
                var configProvider = FunqRegistry.ConfigProvider;
                var apiToken       = FunqRegistry.ApiToken;
                var dataProvider   = new ConfigProvider("");
                var mtierProvider  = new MTierProvider(dataProvider);
                var mtier          = mtierProvider.GetMTier();
                _channelConnection = new ChannelConnection(mtier, configProvider, apiToken);

                var          dueTime     = DateTime.Now.AddDays(2).ToShortDateString();
                const string description = "Test Description";

                // Send the notification
                _channelConnection.SendNotification(new Notification
                {
                    Title   = "New Work Order Assignment",
                    Message = string.Format("{0}. You are assigned a new work order{1}.", description, dueTime)
                              //ActionCode = "WorkOrderAssignment",
                              //ActionData = new Dictionary<string, object>
                              //{
                              //    {"Prop1", "Prop1Value"},
                              //}
                }, 73);
            }
            catch (Exception ex)
            {
                throw new Exception(
                          string.Format("Failed sending push notification. Details are: Message: {0}, StackTrace: {1}",
                                        ex.Message, ex.StackTrace));
            }

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Ejemplo n.º 2
0
 public ChannelBase(MemoryStreamPool memoryStreamPool, ILogManager logManager,
                    ChannelDescriptor descriptor, IChannelConnection connection)
 {
     this.memoryStreamPool = memoryStreamPool;
     this.Descriptor       = descriptor;
     this.connection       = connection;
     this.logger           = logManager.GetLogger(this.GetType().Name);
 }
Ejemplo n.º 3
0
 public ReliableChannel(MemoryStreamPool memoryStreamPool, ILogManager logManager,
                        ChannelDescriptor descriptor, IChannelConnection connection, bool ordered)
     : base(memoryStreamPool, logManager, descriptor, connection)
 {
     this.ordered         = ordered;
     this.recvWindowStart = 0;
     this.ackWindowStart  = 0;
     if (ordered)
     {
         this.recvWithheld = new Datagram[WINDOW_SIZE];
     }
     else
     {
         this.recvEarlyReceived = new bool[WINDOW_SIZE];
     }
     this.sendPendingPackets = new PendingPacket[WINDOW_SIZE];
     this.sendDelayedPackets = new ConcurrentQueue <Datagram>();
 }
Ejemplo n.º 4
0
 public void AddUnauthenticatedConnection(IChannelConnection connection)
 {
     //logger.Debug($"AddUnauthenticatedChannel():channel.Path={channel.WebRequest.RequestUri.AbsolutePath}");
     this.unauthenticatedConnections[connection] = connection;
 }
Ejemplo n.º 5
0
 public UnreliableChannel(MemoryStreamPool memoryStreamPool, ILogManager logManager,
                          ChannelDescriptor descriptor, IChannelConnection connection)
     : base(memoryStreamPool, logManager, descriptor, connection)
 {
 }
Ejemplo n.º 6
0
 public Channel(IChannelConnection connection, string channelKey, Dict vars)
 {
     this.connection = connection;
     this.channelKey = channelKey;
     this.vars       = vars;
 }
Ejemplo n.º 7
0
 public Channel(byte channel, IChannelConnection connection, int index)
 {
     this.channel    = channel;
     this.connection = connection;
     this.index      = index;
 }