-
-
Save darkl/bdbc6b97299d72eb32c8 to your computer and use it in GitHub Desktop.
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 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