1.协议

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace WCFHub.IService
{
    [ServiceContract(CallbackContract=typeof(IEventCallback))]
    public interface IEventService
    {
        [OperationContract(IsOneWay = true)]
        void Subscribe(SubscribeArg a);

        [OperationContract(IsOneWay = true)]
        void Unsubscribe(ArgumentBase<String> a);

        [OperationContract]
        DateTime Ping();

    }

    public interface IEventCallback
    {
         [OperationContract(IsOneWay = true)]
        void OnMessageReceived(ArgumentBase<String> a);
    }
}
View Code

相关文章: