public override void Stop() { logger.Log("AppDigitalMedia clean up"); if (worker != null) { worker.Abort(); } if (datastream != null) { datastream.Close(); } if (serviceHost != null) { serviceHost.Close(); } if (appServer != null) { appServer.Dispose(); } if (SignalR != null) { SignalR.Dispose(); } }
protected override System.Threading.Tasks.Task OnReceivedAsync( SignalR.IRequest request, string connectionId, string data) { return base.Connection.Broadcast(data); }
public SignalR.Hubs.IHub Create(SignalR.Hubs.HubDescriptor descriptor) { if (descriptor.Type == null) return null; return (SignalR.Hubs.IHub)_kernel.Get(descriptor.Type); }
private async Task Conectar(Profile profile) { btnFacebook.Visibility = Android.Views.ViewStates.Gone; Usuario usuarioNovo = new Usuario(); usuarioNovo.Nome = profile.FirstName; usuarioNovo.Sobrenome = profile.LastName; usuarioNovo.IDProfile = profile.Id; //await ChatDataStore<Usuario>.Instance.AddAsync(usuario); var connection = await SignalR.GetHubConnection(); Usuario usuario = await new UsuarioRepository().GetUsuarioAsync(usuarioNovo.IDProfile); if (usuario == null) { await new UsuarioRepository().SalvarUsuarioAsync(usuarioNovo); await connection.InvokeAsync("Conectar", usuarioNovo); } else { await new UsuarioRepository().SalvarUsuarioAsync(usuarioNovo); await connection.InvokeAsync("Conectar", usuarioNovo); } //GetHash(); jaEntrou = true; var intent = new Intent(this, typeof(PrincipalActivity)); intent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); StartActivity(intent); Finish(); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Sala); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); hubConnection = await SignalR.GetHubConnection(); hubConnection.On <Mensagem>("ReceberMensagem", (novaMensagem) => { RunOnUiThread(() => { novaMensagem.Tipo = UserType.OTHER; mensagens.Add(novaMensagem); AtualizarMensagens(); }); }); #region eventos ovIB_Enviar.SetOnClickListener(this); ovET_Mensagem.SetOnKeyListener(this); ovET_Mensagem.AddTextChangedListener(this); #endregion }
protected override System.Threading.Tasks.Task OnConnectedAsync(SignalR.Hosting.IRequest request, string connectionId) { UserCount += 1; Debug.WriteLine("OnConnectedAsync " + UserCount); this.Connection.Broadcast(UserCount); return base.OnConnectedAsync(request, connectionId); }
public void StopServices() { WriteLog("停止服务"); //StopConnectEngine(); if (LocationService.u3dositionSP != null) { LocationService.u3dositionSP.Stop(); LocationService.u3dositionSP = null; } if (httpHost != null) { httpHost.CloseAsync(); httpHost = null; } if (SignalR != null) { SignalR.Dispose(); SignalR = null; } if (wcfApiHost != null) { wcfApiHost.Close(); wcfApiHost = null; } StopReceiveAlarm(); }
public void MapHub(IEndpointRouteBuilder bldr) { string url = SignalR.MakeUrl(nameof(YetaWF_Messenger_SiteAnnouncementsHub)); Logging.AddLog($"{nameof(YetaWF_Messenger_SiteAnnouncementsHub)} adding route {url}"); bldr.MapHub <YetaWF_Messenger_SiteAnnouncementsHub>(url); }
public void MapHub(IEndpointRouteBuilder bldr) { string url = SignalR.MakeUrl(nameof(YetaWF_Messenger_BrowserNotificationsHub)); Logging.AddLog($"{nameof(YetaWF_Messenger_BrowserNotificationsHub)} adding route {url}"); bldr.MapHub <YetaWF_Messenger_BrowserNotificationsHub>(url); }
private void WinFormsServer_FormClosing(object sender, FormClosingEventArgs e) { if (SignalR != null) { SignalR.Dispose(); } }
public Judger(Entity.User user, SignalR.Client client) { ID = user.ID; Nickname = Helpers.ColorName.GetNicknameHtml(user.Nickname, 4000); Gravatar = Helpers.Gravatar.GetAvatarURL(user.Gravatar, 50); Motto = HttpUtility.HtmlEncode(user.Motto); Ratio = client.Ratio; }
/// <summary> /// Stops the server and closes the form. Restart functionality omitted /// for clarity. /// </summary> private void ButtonStop_Click(object sender, RoutedEventArgs e) { SignalR.Dispose(); ButtonStop.IsEnabled = false; ButtonStart.IsEnabled = true; WriteToConsole("---------------------------"); WriteToConsole("Сервер остановлен."); }
public async Task <ActionResult> SkinMessaging() { await SignalR.UseAsync(); Manager.ScriptManager.AddLast($"{AreaRegistration.CurrentPackage.AreaName}_{Module.ClassName}", $"new YetaWF_Messenger.SkinMessagingModule('{YetaWFManager.JserEncode(Module.ModuleHtmlId)}');"); return(new EmptyResult()); }
protected override void OnClosing(CancelEventArgs e) { if (SignalR != null) { SignalR.Dispose(); } base.OnClosing(e); Application.Current.Shutdown(); }
public async Task <ActionResult> SkinBrowserNotifications() { await SignalR.UseAsync(); await Manager.AddOnManager.AddAddOnNamedAsync(AreaRegistration.CurrentPackage.AreaName, nameof(SkinBrowserNotificationsModule)); Manager.ScriptManager.AddLast($"{AreaRegistration.CurrentPackage.AreaName}_{Module.ClassName}", $"new YetaWF_Messenger.SkinBrowserNotificationsModule('{Utility.JserEncode(Module.ModuleHtmlId)}');"); return(new EmptyResult()); }
public string GenerateConnectionId(SignalR.IRequest request) { if (request.Cookies["connectionId"] != null) { return request.Cookies["connectionId"].Value; } else return Guid.NewGuid().ToString(); }
public static IAppBuilder UseSignalRService(this IAppBuilder app, string connectionString, Action <HubServerBuilder> configure) { var signalr = SignalR.Parse(connectionString); var builder = new HubServerBuilder(SignalR.ServiceProvider, signalr); configure(builder); return(app); }
public void Configuration(IAppBuilder app) { // Configure SignalR SignalR.Configure(app); // Configure Azure B2C // Lab // Configure WebApi Common.WebApi.Configure(app); }
public async Task <ActionResult> Messaging() { await SignalR.UseAsync(); Package currentPackage = AreaRegistration.CurrentPackage; await Manager.AddOnManager.AddAddOnNamedAsync(currentPackage.AreaName, "Messaging"); EditModel model = new EditModel { }; return(View(model)); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSignalRService(); var signalr = SignalR.Parse(Configuration["SignalRService:ConnectionString"]); services.AddSingleton(typeof(SignalR), signalr); var timeService = new TimeService(signalr); services.AddSingleton(typeof(TimeService), timeService); }
private async void Connectivity_ConnectivityChanged(object sender, Xamarin.Essentials.ConnectivityChangedEventArgs e) { if (e.NetworkAccess == Xamarin.Essentials.NetworkAccess.Internet) { await SignalR.GetHubConnection(); await SalvarSalaWifi(); salasFragment.Refresh(); Android.Support.V4.App.FragmentTransaction ft = SupportFragmentManager.BeginTransaction(); ft.Detach(salasFragment); ft.Attach(salasFragment); ft.Commit(); } }
/// <summary> /// 停止服务 /// </summary> /// <returns></returns> private async Task StopServer() { if (SignalR != null) { //向客户端广播消息 //hubContext = GlobalHost.ConnectionManager.GetHubContext<SignalRHub>(); await HubContext.Clients.All.SendClose("服务端已关闭"); //await hubContext.Clients.User("").SendClose("服务端已关闭"); //释放对象 SignalR.Dispose(); SignalR = null; Log.Info("服务端已关闭..."); } }
public override void Close() { base.Close(); ServerInfo.Exit(); StopServer(); // Thread.Sleep(2000); #if NO if (SignalR != null) { SignalR.Dispose(); SignalR = null; } #endif }
public bool Start() { var started = false; try { int puerto = 6969; if (ConfigurationManager.AppSettings["SignalR_Port"] != null) { int.TryParse(ConfigurationManager.AppSettings["SignalR_Port"], out puerto); log.Information("SignalR. Configuración para el puerto de singalR (Puerto: {0})", puerto); } else { log.Information("SignalR. No se ha encontrado la configuración del puerto, usando configuración por defecto (Puerto: {0})", puerto); } ServerURI = string.Format("http://+:{0}", puerto); // Si ya está levantado, lo eliminamos antes y lo volvemos a levantar if (SignalR != null) { SignalR.Dispose(); SignalR = null; GC.Collect(); } SignalR = WebApp.Start<Startup>(ServerURI); started = SignalR != null ? true : false; log.Trace("StartSignalRServer: SignalR Server started at " + ServerURI); PingPong(); } catch (TargetInvocationException ex) { log.Error("RequestHub. Start() SignalR Server failed to start. A server is already running on [{0}]", ServerURI != null ? ServerURI : "null", ex); } catch (Exception ex) { log.Error("RequestHub. Start()", ex); } return started; }
public Form1() { InitializeComponent(); _hubConnection = new HubConnectionBuilder().WithUrl("https://localhost:44394/hub").Build(); _hubConnection.Closed += async(error) => { await Task.Delay(new Random().Next(0, 5) * 1000); await _hubConnection.StartAsync(); }; _signalR = new SignalR(_hubConnection); _api = new API(); ghost.DisableTimer(); invoker = new Invoker(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); // app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { var path = typeof(MessagingHub).Name; endpoints.MapGet("/", async context => { // suggested configuration for consumer & producer var needsToBeSecure = !env.IsDevelopment(); var url = context.Request.GetBaseUri(); url += $"/{typeof(MessagingHub).Name}"; var suggestedConfig = new SignalR { HubUrl = url, NeedsToBeSecure = needsToBeSecure }; var serialized = JsonSerializer.Serialize(suggestedConfig); await context.Response.WriteAsync($"{serialized}\n"); //var connection = MessagingHub.GetConnection(url, needsToBeSecure); //await connection.StartAsync(); //var mySerializedObject = new //{ // ServerTime = DateTime.Now, // ServerSays = message //}; //await connection.InvokeAsync(nameof(MessagingHub.Broadcast), mySerializedObject); }); endpoints.MapHub <MessagingHub>(path); }); }
void Start() { uiText = GameObject.Find("Text").GetComponent <Text>(); DisplayMessage(statusText); var signalR = new SignalR(); signalR.Init(signalRHubURL); signalR.On(HANDLER_A, (string payload) => { var json = JsonUtility.FromJson <JsonPayload>(payload); DisplayMessage($"{HANDLER_A}: {json.message}"); }); signalR.On(HANDLER_B, (string payload) => { var json = JsonUtility.FromJson <JsonPayload>(payload); DisplayMessage($"{HANDLER_B}: {json.message}"); }); signalR.ConnectionStarted += (object sender, ConnectionEventArgs e) => { Debug.Log($"Connected: {e.ConnectionId}"); DisplayMessage(connectedText); var json1 = new JsonPayload { message = messageToSendA }; signalR.Invoke(hubMethodA, JsonUtility.ToJson(json1)); var json2 = new JsonPayload { message = messageToSendB }; signalR.Invoke(hubMethodB, JsonUtility.ToJson(json2)); }; signalR.ConnectionClosed += (object sender, ConnectionEventArgs e) => { Debug.Log($"Disconnected: {e.ConnectionId}"); DisplayMessage(disconnectedText); }; signalR.Connect(); }
public static async Task <bool> CreateGameLobby() { var gameSettings = ModelMapper.Mapper.Map <List <GameSettingDto> >(GameSettings.Values); var response = await HttpHelper.Post <GameLobby, List <GameSettingDto> >("gamelobby", gameSettings); if (response.Response.IsSuccessStatusCode) { DataContainer.GameLobby = response.Result; await SignalR.Connect(); //send request that creater is the lobby owner _ = SignalR.Connection.InvokeAsync("AssumeControlOfLobby", DataContainer.GameLobby.Code); return(true); } return(false); }
public void StopServices() { try { Location.BLL.Tool.Log.NewLogEvent -= ListenToLog; WriteLog("停止服务"); //StopConnectEngine(); if (LocationService.u3dositionSP != null) { LocationService.u3dositionSP.Stop(); LocationService.u3dositionSP = null; } if (locationServiceHost != null) { locationServiceHost.Close(); locationServiceHost = null; } if (httpHost != null) { httpHost.CloseAsync(); httpHost = null; } if (SignalR != null) { SignalR.Dispose(); SignalR = null; } if (wcfApiHost != null) { wcfApiHost.Close(); wcfApiHost = null; } StopReceiveAlarm(); } catch (Exception ex) { ListenToLog(ex.ToString()); } }
public bool Stop() { var stopped = false; try { log.Debug("RequestHub. Stop() Se Procede a parar el servidor"); if (SignalR != null) { SignalR.Dispose(); stopped = true; } } catch (Exception ex) { log.Error("RequestHub. Stop()", ex); } return stopped; }
public void Save(SignalR.Hub.Model.Domain.Config aConfig) { Settings.Default.AutoRegisterNickserv = aConfig.AutoRegisterNickserv; Settings.Default.ElasticSearchHost = aConfig.ElasticSearchHost; Settings.Default.ElasticSearchPort = aConfig.ElasticSearchPort; Settings.Default.SetFileHandlers(aConfig.FileHandlers); Settings.Default.IrcNick = aConfig.IrcNick; Settings.Default.IrcPasswort = aConfig.IrcPasswort; Settings.Default.IrcRegisterEmail = aConfig.IrcRegisterEmail; Settings.Default.JabberPassword = aConfig.JabberPassword; Settings.Default.JabberServer = aConfig.JabberServer; Settings.Default.JabberUser = aConfig.JabberUser; Settings.Default.MaxDownloadSpeedInKB = aConfig.MaxDownloadSpeedInKB; Settings.Default.Password = aConfig.Password; Settings.Default.ReadyPath = aConfig.ReadyPath; Settings.Default.TempPath = aConfig.TempPath; Settings.Default.UseElasticSearch = aConfig.UseElasticSearch; Settings.Default.UseJabberClient = aConfig.UseJabberClient; Settings.Default.UseWebserver = aConfig.UseWebserver; Settings.Default.WebserverPort = aConfig.WebserverPort; Settings.Default.Save(); }
public PinkPacman(SignalR signalr, string id) { _signalR = signalr; Id = id; }
public ActionResult Loginuser(SignalR.Chat.Models.Client chatter) { return View("ChatWindow", chatter); }
public override Pacman CreatePacman(SignalR signalr, string id) { return(new RedPacman(signalr, id)); }
public SignalRAuthController(SignalR signalr) { _signalr = signalr; }
protected override Task OnConnectedAsync(SignalR.Hosting.IRequest request, IEnumerable<string> groups, string connectionId) { Observable.Interval(TimeSpan.FromMilliseconds(ProcessIntervalMilSec)) .Subscribe(x => ProcessLoop()); return _emptyTask; }
public void Initialize(SignalR.Client.IConnection connection) { // Not implemented by MemoryHost }
public void Initialize(SignalR.Client.IConnection connection) { }
protected override Task OnConnectedAsync(SignalR.Hosting.IRequest request, System.Collections.Generic.IEnumerable<string> groups, string connectionId) { return Connection.Broadcast("Client [" + connectionId + "] connected"); }
protected override Task OnConnectedAsync(SignalR.Hosting.IRequest request, IEnumerable<string> groups, string connectionId) { RunAsyncWorkers(); return _emptyTask; }
private void ActiveQuadSignalRNotifier_QuadSelectionConfirmed(SignalR.Container_EventsCallbacks.ActiveQuadContainer.QuadSelectionConfirmed args) { if (args.TheQuad.QuadId == this.userSelectedQuad.QuadId && args.Confirmed) { this.Notifications.text = "Quad selection confirmed."; this.Notifications.gameObject.SetActive(true); this.OkView.interactable = true; } else { this.Notifications.text = "Quad in use please select another."; this.Notifications.gameObject.SetActive(true); this.OkView.interactable = false; } }
public void PublishObservation(SignalR.Common.Dto.Observation observation) { _observers.Where(observer => string.Equals(observer.ObserveeId, observation.Entity.Value, StringComparison.CurrentCultureIgnoreCase) && string.Equals(observer.ObservableId, observation.Observable.Value, StringComparison.CurrentCultureIgnoreCase)) .ForEach(observer => observer.Process(observation.AsDynamicMessage())); }
public void Initialize(SignalR.Client.IConnection connection) { foreach (IHttpClient server in _servers) { server.Initialize(connection); } }
public SignalR() { instance = this; }
public abstract Pacman CreatePacman(SignalR signalr, string id);