Thank you for providing a support site for asking questions about RO/DA. It is very appreciated.
I have a Delphi client/server application that is using Multicast Events and it all works great. I am now trying to configure an ASP.NET website to connect to this same Delphi server to receive events over an IpSuperTCPClientChannel. In my testing, if I setup the “page class” that is a System.Web.UI.Page as the event receiver, the events ARE received, but if I move all the event receiving code to a singleton object in the ASP.NET project, I see the registration being made on the server side, but I never see any events being received on the client-side.
I have been unable to find any examples on the web that illustrate setting up event receivers in ASP.NET, so I don’t really have much to go by except the “Multicast Events” RemObjects wiki article. Are there any examples available that illustrate setting up event receiving for ASP.NET? Or do you happen to know why I am experiencing the behavior I illustrated above, or have any other tips or suggestions on setting this up properly?
In .NET, I am using RemObjects.SDK v6.0.51.901
In Delphi, I am using RemObjects SDK v6.0.45.821
ROWeb - ASP.NET web application. To keep things simple it just listens to the remote chat and page itself is refreshed only when you press ‘Refresh’ button.
Let’s take a look at ROWeb application closer. It uses the same mechanism as WinForms application (ChatClient). At first, it is necessary to register event receiver:
ProxyEventHandler.cs
public sealed class ProxyEventHandler : IChatEvents
{
private EventReceiver fEventsReceiver;
. . .
public ProxyEventHandler(String aUsername)
{
. . .
this.fEventsReceiver = new EventReceiver();
this.fEventsReceiver.Channel = this.fClientChannel;
this.fEventsReceiver.Message = this.fClienMessage;
this.fEventsReceiver.RegisterEventHandler(this, typeof(IChatEvents));
fLoginService.Login("User " + (new Random()).Next().ToString());
fChatService.Talk("Hi all!");
}
}
Then need to implement appropriate interface with multicast events:
ProxyEventHandler.cs
public sealed class ProxyEventHandler : IChatEvents
{
. . .
public void AddMessage(String aMessage)
{
lock (this.fMessagesQueue)
{
this.fMessagesQueue.Enqueue(aMessage);
}
}
. . .
#region IChatEvents Members
public void Message(String From, String Target, String Message)
{
this.AddMessage(String.Format("From {0} to {1}: {2}", From, Target, Message));
}
public void UserLogin(string Nickname)
{
this.AddMessage(String.Format("{0} entered chat", Nickname));
}
public void UserLogout(string Nickname)
{
this.AddMessage(String.Format("{0} leaved chat", Nickname));
}
#endregion
}
All the events came from the server are stored in the queue. Client can use/show this messages by getting this queue:
When you mention the attachment archive, what exactly are you referring to? I had previously found the chat sample you mentioned in the RemObjects SDK samples, but This ASP.NET HTTP Chat demo is new to me.
Thank you for posting this, I will be taking an in-depth look at it tomorrow and respond back if I have any further questions or to accept the solution.
Ah! my mistake. You meant “archive” as in the zip file. I had thought you meant archive as in some place I could have found this sample prior to asking my question.
Thank you for pulling this sample together. Truly appreciated. Will post back tomorrow.
Probably not going to have a chance to look at this for a few, so I’m just going to go ahead and accept it for now since you probably looked at it prior to posting it. Thank you for your help!
Just wanted to report back that I was able to determine what my problem was by comparing my implementation to yours. Thank you for taking the time to prepare this example project!