Click here to Skip to main content
15,314,714 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I do hope that I describe the problem that I have correctly.

We used to have an ActiveX lib that a web page (using client side javescript) was using to do stuff and to handle the events raised by the activex library. the ActiveX communicates with tcp to a server.

We want to replicate the scenario by using modern technology.

So I was thinking of creating a windows service (WCF ? ) that communicates with the server using tcp sockets and have all needed communication.
This service Must be able to raise events when some things in server occur.

This communication must be kept alive in order for the service to keep getting data until we choose to "close the Channel"
Then my web page will reference (client side) this local service and be able to handle the above events.

In current code the webpage has something like this :
JavaScript
<object	classid="CLSID:1234-5678-906666666666" id="byobjectname" v:shapes="_x0000_s1025" class="shape" width="60" height="55">
<param name="ServerName" value="111.111.111.111"/>
<param name="NetworkType" value="ncacn_ip_tcp"/>
</object>

then in my code we have something like this
JavaScript
<SCRIPT LANGUAGE="javascript" FOR=byobjectname EVENT="MyEvent1 (Value1,newValue2)">


What technologies should we use to implement this Using visual studio c# or vb.net
Are there any examples of sources for me to read.

Thank you in advance

What I have tried:

So far I have tried with web services to communicate with the server but I wanted to keep the connection alive and each web service call to have a unique instance to get back events. so I went to local web service to each client pc.
Posted
Updated 4-Mar-16 4:23am
v2
Comments
Richard Deeming 2-Mar-16 12:33pm
   
Are you looking for SignalR[^]?
Member 3058688 3-Mar-16 5:40am
   
I will have a look at it but I think is communication between web server and client.
DotNetSteve 2-Mar-16 22:41pm
   
Can you clarify? Do you want to notify the web client when an event occurs on the server or notify the server when event occurs on the web client?
Member 3058688 3-Mar-16 5:38am
   
Yes I want the web page to have the event handler to act when the service raises the event. (after the communication of the service with the server (already made))

The second "notify the server when event occurs on the web client?" is just a function call of the service.
Sinisa Hajnal 3-Mar-16 6:51am
   
Use http://signalr.net/ signalR -> does exactly what you described. When something happens on the server it "pushes" the notification to the client.
DotNetSteve 3-Mar-16 7:37am
   
The other posts are correct, look for SignalR
Member 3058688 3-Mar-16 7:49am
   
Let me put some more information. The SERVER_APP is a windows application that speaks with an asterisk server.
WinAppService_1 is hosted on each client pc and communicates with the SERVER_APP using tcp sockets.
What I need is that the WinAppService_1 will work like the Old activeX and according to data and states will be able to raise events.
I want to have a WINDOWS application OR a web page with client side javascript, to communicate with this WinAppService_1 and handle this events.
I do not know how to make this WinAppService_1 to be able to raise events and how to call it from javascript as we used to do with the old activeX

1 solution

As stated before you want to look at SIGNALR or you can use Websockets directly from JavaScript, but SignalR does this for you.
   
Comments
Member 3058688 4-Mar-16 11:09am
   
Thanx for the answer but this covers the case of a windows app calling the service>?

As I said yesterday "Let me put some more information. The SERVER_APP is a windows application that speaks with an asterisk server.
WinAppService_1 is hosted on each client pc and communicates with the SERVER_APP using tcp sockets.
What I need is that the WinAppService_1 will work like the Old activeX and according to data and states will be able to raise events.
I want to have a WINDOWS application OR a web page with client side javascript, to communicate with this WinAppService_1 and handle this events.
I do not know how to make this WinAppService_1 to be able to raise events and how to call it from javascript as we used to do with the old activeX"

this means that I want to have the logic of the communication to WinAppService_1 and not to the windows or web app. (the same way of the previous ActiveX Library worked)
Frank Kerrigan 4-Mar-16 15:02pm
   
Call the activeX from the server and load one for each client, then use signalr as bridge between javascript and the server.

JavaScript <--> SignalR <--> WebService <--> ActiveX <--> WinAppService_1

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900