This works on html 5 supported browsers.
A Pen by Chinh Vo Wili on CodePen.
| @Configuration | |
| @EnableWebFlux | |
| @Slf4j | |
| public class SimpleWebSocketHandler implements WebSocketHandler { | |
| @Bean | |
| public SimpleUrlHandlerMapping simpleUrlHandlerMapping() { | |
| Map<String, WebSocketHandler> urlMap = new HashMap<>(); | |
| urlMap.put("/ws", this::handle); |
| # Set the Azure provider source and version being used | |
| terraform { | |
| required_providers { | |
| azurerm = { | |
| source = "hashicorp/azurerm" | |
| version = "=3.0.0" | |
| } | |
| } | |
| } | |
| # Configure the Microsoft Azure Provider |
| /** | |
| * Methods required by a custom player for `react-player` | |
| */ | |
| export interface Player { | |
| load(url?: string): void; | |
| seekTo(amount: number, type?: 'seconds' | 'fraction'): void; | |
| getCurrentTime(): number; | |
| getDuration(): number; | |
| getSecondsLoaded(): number | null; | |
| stop?(): void; |
| import React, { Component } from "react"; | |
| import ReactPlayer, { ReactPlayerProps } from "react-player"; | |
| import { getSDK } from "react-player/lib/utils"; | |
| import { | |
| Player, | |
| IkWidget, | |
| KalturaNotificationName, | |
| KalturaPlayerElement, | |
| KalturaPlayerEvents, |
| app.MapGet("/background", ( | |
| PeriodicHostedService service) => | |
| { | |
| return new PeriodicHostedServiceState(service.IsEnabled); | |
| }); |
| class PeriodicHostedService : BackgroundService | |
| { | |
| private readonly TimeSpan _period = TimeSpan.FromSeconds(5); | |
| private readonly ILogger<PeriodicHostedService> _logger; | |
| private readonly IServiceScopeFactory _factory; | |
| private int _executionCount = 0; | |
| public bool IsEnabled { get; set; } | |
| public PeriodicHostedService( | |
| ILogger<PeriodicHostedService> logger, |
| private int _executionCount = 0; | |
| public bool IsEnabled { get; set; } | |
| protected override async Task ExecuteAsync(CancellationToken stoppingToken) | |
| { | |
| using PeriodicTimer timer = new PeriodicTimer(_period); | |
| while ( | |
| !stoppingToken.IsCancellationRequested && | |
| await timer.WaitForNextTickAsync(stoppingToken)) | |
| { |
This works on html 5 supported browsers.
A Pen by Chinh Vo Wili on CodePen.
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Net.Http; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.AspNetCore.Mvc; | |
| namespace TestAPIGithub.Controllers | |
| { |
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| services.AddControllers(); | |
| //configure httpclient service | |
| services.AddHttpClient("GithubAPI", client=> | |
| { | |
| //customize as per your need | |
| client.BaseAddress = new Uri("http://api.github.com/"); | |
| client.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json"); |