Note that there are some explanatory texts on larger screens.

plurals
  1. POSignalR signs out ServiceStack session
    text
    copied!<p>I seem to have a strange problem between ServiceStack and SignalR. Both services work ok, no odd activity, SignarlR Hub loads successfully and works as expected. ServiceStack authenticates via Google ok, no issues there.</p> <p>However, once I sign into the site with SS, all is fine, problem seems comes when I navigate to a page that is using SignalR. Once the javascript for SignalR has inititalised, it seems to clear all session info for ServiceStack on the server. Meaning if I refresh the page, I get redirected back to login. However, if I leave the page as is, the SignalR notifications arrive as expected.</p> <p>Anyone got any ideas what could be going on?</p> <p>My simple code is based off the StockTicker example. Here it is:</p> <pre><code>&lt;HubName("salesTicker")&gt; _ </code></pre> <p>Public Class VerificationLogHub Inherits Hub Private ReadOnly _verificationTicker As VerificationLogTicker</p> <pre><code>Public Sub New() Me.New(VerificationLogTicker.Instance) End Sub Public Sub New(verTicker As VerificationLogTicker) _verificationTicker = verTicker End Sub Public Function GetAllLogs() As IEnumerable(Of UI_GuestBook) Return _verificationTicker.GetAllLogs() End Function Public Sub start() _verificationTicker.StartMonitoring() End Sub Public Sub [stop]() _verificationTicker.StopMonitoring() End Sub </code></pre> <p>End Class</p> <p>The Ticker class is virtually identical to the StockTicker example only difference being, I'm fetching my data from my database not obviously not generating randon stock prices. </p> <p>And here's the page javascript that gets the ball rolling.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { var ticker = $.connection.salesTicker; $.connection.hub.start().pipe(init); function init() { return ticker.server.getAllLogs().done(function (guestBooksLog) { ticker.server.start(); if(guestBooksLog.length&gt;0) updateStats(guestBooksLog[0]); }); } $.extend(ticker.client, { updateStockPrice: function (GuestBook) { updateStats(GuestBook); } }); }); function updateStats(GuestBook) { $('#spanLsRate').html((GuestBook.Rate * 100).toFixed(1)); $('#spanDcCount').html(GuestBook.TotalCount); console.log("Stats updated..."); } </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload