Skip to content

Instantly share code, notes, and snippets.

@NTaylorMullen
Last active December 15, 2015 14:28
Show Gist options
  • Save NTaylorMullen/5274211 to your computer and use it in GitHub Desktop.
Save NTaylorMullen/5274211 to your computer and use it in GitHub Desktop.
MoveShapeHub.cs (Broadcast version) REVISION
using System;
using System.Threading;
using Microsoft.AspNet.SignalR;
namespace MoveShape
{
public class MoveShapeHub : Hub
{
// Is set via the constructor on each creation
private Broadcaster _broadcaster;
public MoveShapeHub()
: this(Broadcaster.Instance)
{
}
public MoveShapeHub(Broadcaster broadcaster)
{
_broadcaster = broadcaster;
}
public void UpdateModel(ShapeModel clientModel)
{
clientModel.LastUpdatedBy = Context.ConnectionId;
// Update the shape model within our broadcaster
_broadcaster.UpdateShape(clientModel);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment