Вот что у меня есть:
IService:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace ServiceLibrary
{
[ServiceContract(SessionMode = SessionMode.Allowed, CallbackContract = typeof(IServiceCallback))]
public interface IService
{
[OperationContract(IsOneWay = false, IsInitiating = true, IsTerminating = false)]
void Join(string userName);
}
interface IServiceCallback
{
[OperationContract(IsOneWay = true)]
void UserJoined(string senderName);
}
}
Услуги:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace ServiceLibrary
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
public class Service:IService
{
IServiceCallback callback = null;
public void Join(string userName)
{
callback = OperationContext.Current.GetCallbackChannel<IServiceCallback>();
}
}
}
Просто простая строка, передаваемая от одного клиента другому.