Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- string url =
- @"http://localhost:8080/";
- using (WebApp.Start<Startup>(url))
- {
- Console.WriteLine(string.Format("Server
- running at {0}", url));
- Console.ReadLine();
- }
- }
- }
- public class Test : Hub
- {
- public void S(string message)
- {
- Clients.All.R(message);
- }
- }
- public class Startup
- {
- public void Configuration(IAppBuilder app)
- {
- app.UseCors(CorsOptions.AllowAll);
- app.MapSignalR();
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- IHubProxy _hub;
- string url = @"http://localhost:8080/";
- var connection = new HubConnection(url);
- _hub = connection.CreateHubProxy("Test");
- connection.Start().Wait();
- string line=Console.ReadLine();
- _hub.Invoke("S", line).Wait();
- _hub.On("R", x => Console.WriteLine(x));
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement