private bool TryReadPubishInformaction(SockectPackageMessage package, out PubishInformaction info) { info = null; if (package.Body.Length < 5) { return(false); } var len = BitConverter.ToInt32(package.Body, 0); string topic; if (package.TryReadFromText(package.Body, 4, len, out topic)) { string content; if (package.TryReadFromText(package.Body, 4 + len, package.Body.Length - 4 - len, out content)) { info = new PubishInformaction() { Topic = topic, Content = content }; return(true); } } return(false); }
public override void Handler(SocketClient client, SockectPackageMessage package) { PubishInformaction info; if (TryReadPubishInformaction(package, out info)) { new EventAggregator().RemotePublish(info); } }
public void RemoteCallback(SocketClient client, SockectPackageMessage package) { EventJsonWrapper eventJson; if (package.TryReadFromJsonStream(out eventJson)) { var publisher = PublisherFactory.Create(); if (publisher.PublisherId != eventJson.PublisherId) { publisher.PublishAsync(eventJson); } } }
public virtual void Handler(SocketClient client, SockectPackageMessage package) { }