Skip to content

Instantly share code, notes, and snippets.

@darkl

darkl/Program.cs Secret

Created August 24, 2015 16:49
Show Gist options
  • Save darkl/bdbc6b97299d72eb32c8 to your computer and use it in GitHub Desktop.
Save darkl/bdbc6b97299d72eb32c8 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using WampSharp.V2;
using WampSharp.V2.Realm;
namespace MyServer
{
class Program
{
static void Main(string[] args)
{
const string serverAddress = "ws://127.0.0.1:8080/ws";
WampHost host = new DefaultWampHost(serverAddress);
IWampHostedRealm realm = host.RealmContainer.GetRealmByName("realm1");
List<ISubject<int>> list = new List<ISubject<int>>();
for (int i = 0; i < 800; i++)
{
ISubject<int> subject = realm.Services.GetSubject<int>("com.example.oncounter" + i);
list.Add(subject);
}
Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(1)).Subscribe(x =>
{
for (int i = 0; i < 200; i++)
{
foreach (ISubject<int> subject in list)
{
subject.OnNext(i);
}
}
});
host.Open();
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment