This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static TResult Retry(this IRedisClient client, Func<TResult> Retry) | |
{ | |
try | |
{ | |
return (TResult)Retry.Invoke(); | |
} | |
catch(RedisException RedisException) | |
{ | |
//Do Something Here To Wait | |
return (TResult)Retry.Invoke(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var oldUser = User; | |
User.UserStatus = (UserStatuses)Status; | |
var newUser = User; | |
using(var client = ClientManager.GetClient()) | |
{ | |
client.Replace<UserModel>(UsersKey, oldUser, newUser); | |
} | |
return User; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sometimes you need to just udpate something and assure that it happens | |
*/ | |
public static class GenericReplaceLock | |
{ | |
public static void Replace<T>(this IRedisClient Client, string key, T old, T newer) | |
{ | |
using (var redis = Client.As<T>()) | |
using (var transaction = redis.CreateTransaction()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Joins the chat. | |
/// </summary> | |
/// <param name="UserName">Name of the user.</param> | |
/// <param name="authguid">The authguid.</param> | |
/// <exception cref="System.Exception"> | |
/// Unable to find user | |
/// or | |
/// Unable to authorize user | |
/// </exception> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async void CheckForRooms() | |
{ | |
var getRooms = new Task<IList<RoomModel>>(() => { return _roomRepo.Rooms(); }); | |
var Rooms = await getRooms; | |
var emptyRooms = new List<RoomModel>(); | |
foreach (var room in Rooms) | |
{ | |
if (_userRoomRepo.GetUsersForRoom(room.RoomName).Any()) | |
{ | |
emptyRooms.Add(room); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNet.SignalR; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
namespace noproxySignalR | |
{ | |
//This is the code required for the hub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is the code required for the hub | |
public class TestHub :Hub | |
{ | |
public void joinGroup() | |
{ | |
Groups.Add(Context.ConnectionId, "base"); | |
} | |
public void Send() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TinyChat = TinyChat || {}; | |
TinyChat.ConnectionID = ''; | |
TinyChat.Connection = null; | |
TinyChat.Proxy = null; | |
TinyChat.StartChat = function () { | |
TinyChat.Connection = $.hubConnection(); | |
TinyChat.Connection.logging = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MvcApplication : System.Web.HttpApplication | |
{ | |
protected void Application_Start() | |
{ | |
System.Diagnostics.Debugger.Launch(); | |
AreaRegistration.RegisterAllAreas(); | |
WebApiConfig.Register(GlobalConfiguration.Configuration); | |
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); | |
RouteConfig.RegisterRoutes(RouteTable.Routes); | |
BundleConfig.RegisterBundles(BundleTable.Bundles); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.connection.hub.start().done(function() { | |
$.connection.myHub.server.test(['1', '2', '3']); | |
}); |