コード例 #1
0
ファイル: RtmpClient.cs プロジェクト: DarkActive/daFluorineFx
 public void Receive <T>(Responder <T> responder)
 {
     try
     {
         TypeHelper._Init();
         Invoke           invoke      = new Invoke();
         PendingCall      pendingCall = new PendingCall(null, null);
         ResponderHandler handler     = new ResponderHandler(responder);
         pendingCall.RegisterCallback(handler);
         _connection.RegisterPendingReceive(pendingCall);
     }
     catch (Exception ex)
     {
         _netConnection.RaiseNetStatus(ex);
     }
 }
コード例 #2
0
 public void Call <T>(string command, Responder <T> responder, params object[] arguments)
 {
     try
     {
         TypeHelper._Init();
         Invoke           invoke      = new Invoke();
         PendingCall      pendingCall = new PendingCall(command, arguments);
         ResponderHandler handler     = new ResponderHandler(responder);
         pendingCall.RegisterCallback(handler);
         invoke.ServiceCall = pendingCall;
         invoke.InvokeId    = _connection.InvokeId;
         _connection.RegisterPendingCall(invoke.InvokeId, pendingCall);
         Write(invoke);
     }
     catch (Exception ex)
     {
         _netConnection.RaiseNetStatus(ex);
     }
 }
コード例 #3
0
        public void Call <T>(string endpoint, string destination, string source, string operation, Responder <T> responder, params object[] arguments)
        {
            if (_netConnection.ObjectEncoding == ObjectEncoding.AMF0)
            {
                throw new NotSupportedException("AMF0 not supported for Flex RPC");
            }
            try
            {
                TypeHelper._Init();

                RemotingMessage remotingMessage = new RemotingMessage();
                remotingMessage.clientId    = Guid.NewGuid().ToString("D");
                remotingMessage.destination = destination;
                remotingMessage.messageId   = Guid.NewGuid().ToString("D");
                remotingMessage.timestamp   = 0;
                remotingMessage.timeToLive  = 0;
                remotingMessage.SetHeader(MessageBase.EndpointHeader, endpoint);
                remotingMessage.SetHeader(MessageBase.FlexClientIdHeader, _netConnection.ClientId ?? "nil");
                //Service stuff
                remotingMessage.source    = source;
                remotingMessage.operation = operation;
                remotingMessage.body      = arguments;

                FlexInvoke       invoke      = new FlexInvoke();
                PendingCall      pendingCall = new PendingCall(null, new object[] { remotingMessage });
                ResponderHandler handler     = new ResponderHandler(responder);
                pendingCall.RegisterCallback(handler);
                invoke.ServiceCall = pendingCall;
                invoke.InvokeId    = _connection.InvokeId;
                _connection.RegisterPendingCall(invoke.InvokeId, pendingCall);
                Write(invoke);
            }
            catch (Exception ex)
            {
                _netConnection.RaiseNetStatus(ex);
            }
        }
コード例 #4
0
        public void Call<T>(string endpoint, string destination, string source, string operation, Responder<T> responder, params object[] arguments)
        {
            if (_netConnection.ObjectEncoding == ObjectEncoding.AMF0)
                throw new NotSupportedException("AMF0 not supported for Flex RPC");
            try
            {
                TypeHelper._Init();

                Uri uri = new Uri(_gatewayUrl);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
                request.ContentType = ContentType.AMF;
                request.Method = "POST";
            #if !(SILVERLIGHT)
                request.CookieContainer = _netConnection.CookieContainer;
            #endif
                AMFMessage amfMessage = new AMFMessage((ushort)_netConnection.ObjectEncoding);

                RemotingMessage remotingMessage = new RemotingMessage();
                remotingMessage.clientId = Guid.NewGuid().ToString("D");
                remotingMessage.destination = destination;
                remotingMessage.messageId = Guid.NewGuid().ToString("D");
                remotingMessage.timestamp = 0;
                remotingMessage.timeToLive = 0;
                remotingMessage.SetHeader(MessageBase.EndpointHeader, endpoint);
                remotingMessage.SetHeader(MessageBase.FlexClientIdHeader, _netConnection.ClientId ?? "nil");
                //Service stuff
                remotingMessage.source = source;
                remotingMessage.operation = operation;
                remotingMessage.body = arguments;

                foreach (KeyValuePair<string, AMFHeader> entry in _netConnection.Headers)
                {
                    amfMessage.AddHeader(entry.Value);
                }
                AMFBody amfBody = new AMFBody(null, null, new object[] { remotingMessage });
                amfMessage.AddBody(amfBody);

                AmfRequestData amfRequestData = new AmfRequestData(request, amfMessage, null, null, responder);
                request.BeginGetRequestStream(BeginRequestFlexCall, amfRequestData);
            }
            catch (Exception ex)
            {
                _netConnection.RaiseNetStatus(ex);
            }
        }
コード例 #5
0
 /// <summary>
 /// Invokes a command or method on the server to which this connection is connected.
 /// </summary>
 /// <typeparam name="T">Return type from a remote method invocation.</typeparam>
 /// <param name="endpoint">Flex RPC endpoint name.</param>
 /// <param name="destination">Flex RPC message destination.</param>
 /// <param name="source">The name of the service to be called including namespace name.</param>
 /// <param name="operation">The name of the remote method/operation that should be called.</param>
 /// <param name="responder">An optional object that is used to handle return values from the server.</param>
 /// <param name="arguments">Optional arguments. These arguments are passed to the method specified in the command parameter when the method is executed on the remote application server.</param>
 /// <remarks>
 /// For RTMP connection this method throws a NotSupportedException.
 /// </remarks>
 public void Call <T>(string endpoint, string destination, string source, string operation, Responder <T> responder, params object[] arguments)
 {
     _netConnectionClient.Call(endpoint, destination, source, operation, responder, arguments);
 }
コード例 #6
0
 /// <summary>
 /// Invokes a command or method on the server to which this connection is connected.
 /// </summary>
 /// <typeparam name="T">Return type from a remote method invocation.</typeparam>
 /// <param name="command">A method specified in object path form.</param>
 /// <param name="responder">An optional object that is used to handle return values from the server.</param>
 /// <param name="arguments">Optional arguments. These arguments are passed to the method specified in the command parameter when the method is executed on the remote application server.</param>
 public void Call <T>(string command, Responder <T> responder, params object[] arguments)
 {
     _netConnectionClient.Call(command, responder, arguments);
 }
コード例 #7
0
 public void Receive <T>(Responder <T> responder)
 {
     _netConnectionClient.Receive <T>(responder);
 }
コード例 #8
0
 /// <summary>
 /// Invokes a command on the server
 /// </summary>
 /// <param name="command">A method specified in object path form.</param>
 /// <param name="callback">An optional object that is used to handle return values from the server.</param>
 /// <param name="arguments">Optional arguments. These arguments are passed to the method specified in the command parameter when the method is executed on the remote application server.</param>
 public void Command <T>(string endpoint, string destination, string operation, string subtopic, Responder <T> responder, params object[] arguments)
 {
     _netConnectionClient.Command(endpoint, destination, operation, subtopic, responder, arguments);
 }
コード例 #9
0
ファイル: RtmpClient.cs プロジェクト: DarkActive/daFluorineFx
        public void Command <T>(string endpoint, string destination, string operation, string subtopic, Responder <T> responder, params object[] arguments)
        {
            if (_netConnection.ObjectEncoding == ObjectEncoding.AMF0)
            {
                throw new NotSupportedException("AMF0 not supported for Flex RPC");
            }

            try
            {
                TypeHelper._Init();

                CommandMessage commandMessage;
                if (operation == "subscribe")
                {
                    commandMessage = new CommandMessage(CommandMessage.SubscribeOperation);
                }
                else
                {
                    commandMessage = new CommandMessage(CommandMessage.UnsubscribeOperation);
                }

                commandMessage.destination = destination;
                commandMessage.clientId    = subtopic;
                commandMessage.messageId   = Guid.NewGuid().ToString("D");
                commandMessage.timestamp   = 0;
                commandMessage.timeToLive  = 0;
                commandMessage.SetHeader(MessageBase.EndpointHeader, endpoint);
                commandMessage.SetHeader(MessageBase.FlexClientIdHeader, _netConnection.ClientId ?? "nil");
                commandMessage.SetHeader(AsyncMessage.SubtopicHeader, subtopic);
                commandMessage.body = arguments;

                //Console.WriteLine("WTF Command Message Endpoint: " + endpoint + " ClientID: " + _netConnection.ClientId);

                FlexInvoke       invoke      = new FlexInvoke();
                PendingCall      pendingCall = new PendingCall(null, new object[] { commandMessage });
                ResponderHandler handler     = new ResponderHandler(responder);
                pendingCall.RegisterCallback(handler);
                invoke.ServiceCall = pendingCall;
                invoke.InvokeId    = _connection.InvokeId;
                _connection.RegisterPendingCall(invoke.InvokeId, pendingCall);
                Write(invoke);

                //Console.WriteLine("CLIENT ID: " + _connection.GetStreamById(0).Connection.Client.Id);

                /*
                 * ChannelDefinition channelDefinition = new ChannelDefinition();
                 * channelDefinition.Class = "flex.messaging.endpoints.";
                 * channelDefinition.Id = "3";
                 *
                 * MessageBroker msgBroker = MessageBroker.GetMessageBroker(null);
                 *
                 * ServicesConfiguration sc = new ServicesConfiguration();
                 * ServiceDefinition serviceDefinition = new ServiceDefinition(sc);
                 *
                 * serviceDefinition.Id = FluorineFx.Messaging.Services.RemotingService.RemotingServiceId;
                 * serviceDefinition.Class = typeof(FluorineFx.Messaging.Services.RemotingService).FullName;
                 * serviceDefinition.MessageTypes = "flex.messaging.messages.AsyncMessage";
                 *
                 * AdapterDefinition def = new AdapterDefinition();
                 * def.Id = "dotnet";
                 * def.Class = typeof(FluorineFx.Messaging.Services.Messaging.MessagingAdapter).FullName;
                 * def.Default = true;
                 * serviceDefinition.AddAdapter(def);
                 * serviceDefinition.Adapters = new AdapterDefinition[] { def };
                 * AdapterRef adapterRef = new AdapterRef();
                 * adapterRef.Ref = "dotnet";
                 *
                 * DestinationDefinition destDefinition = new DestinationDefinition(serviceDefinition);
                 * destDefinition.Id = "messagingDestination";
                 * destDefinition.AdapterRef = adapterRef;
                 * DestinationProperties properties = new DestinationProperties();
                 * properties.Source = "*";
                 * destDefinition.Properties = properties;
                 * serviceDefinition.AddDestination(destDefinition);
                 *
                 * RemotingService remotingService = new RemotingService(msgBroker, serviceDefinition);
                 *
                 * Client myClient = new Client(new ClientManager(msgBroker), _netConnection.ClientId);
                 * _connection.Initialize(myClient);
                 *
                 * MessageClient msgClient = new MessageClient(subtopic, new MessageDestination(remotingService, destDefinition), endpoint);
                 *
                 * MessageServer serv = new MessageServer();
                 * serv.ServicesConfiguration = sc;
                 */
            }
            catch (Exception ex)
            {
                _netConnection.RaiseNetStatus(ex);
            }
        }
コード例 #10
0
 public void Command <T>(string endpoint, string destination, string operation, string subtopic, Responder <T> callback, params object[] arguments)
 {
 }
コード例 #11
0
 public void Receive <T>(Responder <T> responder)
 {
 }