Showing posts with label SecondViewer. Show all posts
Showing posts with label SecondViewer. Show all posts

Wednesday, July 23, 2008

WCF services for LibSecondlife/Second Life®

Ok lets talk a little about the service I'm building. As this is my first time building a WCF service, so I have kept it simple. Looking at it right now the front-end service has 6 methods. All are defined as one way. Still de service is setup as "wsDualHttpBinding", for that there is a second interface, this one doesn't has a front-end page. So a little code: (also a little test on how this looks)

[ServiceContract(CallbackContract = typeof(ISecondService))]
public interface IRegisterService
{
[OperationContract(IsOneWay = true)]
void RegisterClient(Guid clientID);

[OperationContract(IsOneWay = true)]
void LoginUser(Guid clientID, LoginData loginData);

[OperationContract(IsOneWay = true)]
void LogoutUser(Guid clientID);

[OperationContract(IsOneWay = true)]
void RecieveMessage(Guid clientID, RecieveMessageBase recieveMessage);
}


This is the main interface. First you register your client with the service. The two other methods are to login/logout of Second Life. The last method is the method used to send a message from your client to the service (the service receives a message).


Now the nice thing about WCF is that you can have "DualHttpBinding", meaning the service can send message to the client. So when Second Life is sending a message to the client, this is first picked up by the WCF service and then send to the client. First of I was thinking of making a polling application, but this is way cleaner. It has his setbacks but more on that on another post. The interface code for the return message looks like this:


public interface ISecondService
{
[OperationContract(IsOneWay = true)]
void CheckAliveClient();

[OperationContract(IsOneWay = true)]
void SendMessage(SendMessageBase message);
}

The first method is a way to check if the client is still alive. The second is to send a message to the client. Its that simple. :)

Ok more on it soon, now trying to build in Chat.


Tuesday, July 22, 2008

Starting work on SecondViewer

I have taken it up on me to write a simple Second Life™ viewer with WCF and Silverlight/WPF. Now that on it self is not a very simple task. There are a few challenges. First there is the communication with the Second Life servers. This is made easy with LibSecondlife, a full Library to communicate with the Second Life servers. Second there is the fact that this all has to run in IIS. Meaning that inside IIS we have to keep a connection alive to the Second Life™ servers.

Hopefully I can keep you informed about my progress on this little blog.