Skip to content

Instantly share code, notes, and snippets.

@perokvist
Last active December 17, 2015 10:49
Show Gist options
  • Save perokvist/5597873 to your computer and use it in GitHub Desktop.
Save perokvist/5597873 to your computer and use it in GitHub Desktop.
Lab 2 - Instructions
public class BroadcastingEventListener : IEventListener
{
private readonly IEnumerable<IBroadcast> _broadcasts;
public BroadcastingEventListener(IEnumerable<IBroadcast> broadcasts)
{
_broadcasts = broadcasts;
}
public async Task ReceiveAsync(IEnumerable<IEvent> events)
{
//Do the stuff
}
}
public class BroadcastToXXX : IBroadcast
{
private readonly IConnectionManager _connectionManager;
public BroadcastToCorrelating(IConnectionManager connectionManager)
{
_connectionManager = connectionManager;
}
public async Task WhenAsync(IEvent @event)
{
//Do the stuff
}
}
public interface IBroadcast
{
Task WhenAsync(IEvent @event);
}
$('#createGame').click(function() {
$.ajax({
type: 'POST',
url: YourEndPointUrlHere,
data: yourDataHere,
dataType: 'json',
success: function (data) {
},
});
});
<script src="/Scripts/toastr.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.signalR-1.1.0.min.js" type="text/javascript"></script>
<script src="~/signalr/hubs" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
//Toastr config
toastr.options = { positionClass: 'toast-bottom-right' };
// Proxy created on the fly
var bhub = $.connection.broadcastHub;
// Declare a function on the chat hub so the server can invoke it
bhub.client.something = function (e) {
toastr.info(e.Title); //Ex
};
// Start the connection
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment