Note: Advice in this article will only work for DotNetBrowser 1.
See the corresponding article for DotNetBrowser 2 here.
DotNetBrowser supports web pages that use WebSockets technology. For example:
MainWindow.xaml
<Window x:Class="WPF.WebSocket.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid Name="mainLayout"> </Grid> </Window>
C#
MainWindow.xaml.cs
using System; using System.IO; using DotNetBrowser; using DotNetBrowser.WPF; using System.Windows; namespace WPF.WebSocket { public partial class MainWindow : Window { Browser browser; WPFBrowserView browserView; public MainWindow() { InitializeComponent(); browser = BrowserFactory.Create(); browserView = new WPFBrowserView(browser); mainLayout.Children.Add(browserView); browserView.Browser.LoadURL("https://www.websocket.org/echo.html"); } } }
VB.NET
MainWindow.xaml.vb
Imports DotNetBrowser Imports DotNetBrowser.WPF Namespace WPF.WebSocket Class MainWindow Dim browser As Browser Dim browserView As WPFBrowserView Public Sub New() InitializeComponent() browser = BrowserFactory.Create() browserView = New WPFBrowserView(browser) mainLayout.Children.Add(browserView) browserView.Browser.LoadURL("https://www.websocket.org/echo.html") End Sub End Class End Namespace