Question

I am trying to run the XSockets StockTicker example found here: http://www.nuget.org/packages/xsockets.sample.stockticker

The package installs and displays StockTicker.html, however the websockets server does not appear to start (honestly I have no idea what the problem could be I just know that the page does not update as it should).

A couple notes:

1.) I am running Visual Studio 2013 which appears to self host apps under IIS Express only. Per the application readme file, I should be running under Visual Studio Development Server:

Right click the project and select properties.

Under the "Web" tab go to the "Servers" section and set Use Visual Studio Development Server

Is this a problem, if so - how to fix it?

2.) StockTicker.html contains this line: conn = new XSockets.WebSocket('ws://127.0.0.1:4502/Stock');

There is no class called "Stock" in the root so I assume this uses MVC convention and refers to StockController.cs which is in the Controllers directory. I modified this line as follows to account for where the sample package installed itself and also the port the app runs under: conn = new XSockets.WebSocket('ws://127.0.0.1:62092/StockTickerSample/Stock');

3.) I added a XSocketsBootstrapper per the readme. When I put a breakpoint in the Start method visual studio tells me no symbols are loaded and the method never executes. Is this related to item 1.) above?

I corrected the reference to jquery.

Was it helpful?

Solution

So just to be sure I installed the sample myself and got it working in a minute.

After installation I got the readme.txt saying:

XSockets.Sample.StockTicker is installed

To start the sample do the following

  1. Add a new XSockets.Web.Bootstrapper (ctrl+shift+a)
  2. Install jQuery (also edit the reference to be the installed version)
  3. Under StockTickerSample right click on StockTicker.html and select "set as startpage"
  4. Right click the project and select properties.
  5. Under the "Web" tab go to the "Servers" section and set Use Visual Studio Development Server

So I followed the steps and also updated the jQuery ref to 2.1.0

Note: Step 4 & 5 is only for visual studio 2012 or earlier since 2013 does not have that option. The reason for doing step 4 & 5 is so that the server will start without a server side resource being requested.

The solution to your problem in 2013 might be as simple as just requesting the root once so that the "App_Start" is fired. And when that is done you can go to

http://localhost:7861/StockTickerSample/StockTicker.html

again, where the port would be something else for you.


You say that you changed to line conn = new XSockets.WebSocket('ws://127.0.0.1:4502/Stock'); to conn = new XSockets.WebSocket('ws://127.0.0.1:62092/StockTickerSample/Stock'); Doing so will surely make things NOT work. XSockets is not the same thing as ASP.NET MVC it is just a MVC pattern.

As you figured out Stock means StockController since the suffix is not needed in XSockets,

You do not even have to run the server inside of the web we only do so in the sample to make it easy to get started. Here is a link to my project that I just created: https://dl.dropboxusercontent.com/u/8639920/SamSample.zip

Look at http://xsockets.net/docs/quick-start and you will get a better understanding about what XSockets is.

Regards Uffe

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top