Answered by:
Does Anyone Have a (Working) sample of messagewebsockets for windows 8 Store app

Question
-
I need to figure out how to setup both the client ans server side using MessageWebSockets for a Windows 8 Store app using VB.net
I am in search of WORKING Samples to help me figure this out. NO C# CODE PLEASE!
I have tried for 7 weeks to convert microsofts sample here:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994397.aspx
and I just will not work
My needs are very simple. All I need is Someone to convert the echo sample below into a working vb.net sample. this is suposed to be the simplest sample out there but it's written in javascript. It works as java script with there server. If I can see how this would be done in vb.net I think I can figure the rest out myself
<!DOCTYPE html> <meta charset="utf-8" /> <title>WebSocket Test</title> <script language="javascript" type="text/javascript"> var wsUri = "ws://echo.websocket.org/"; var output; function init() { output = document.getElementById("output"); testWebSocket(); } function testWebSocket() { websocket = new WebSocket(wsUri); websocket.onopen = function(evt) { onOpen(evt) }; websocket.onclose = function(evt) { onClose(evt) }; websocket.onmessage = function(evt) { onMessage(evt) }; websocket.onerror = function(evt) { onError(evt) }; } function onOpen(evt) { writeToScreen("CONNECTED"); doSend("WebSocket rocks"); } function onClose(evt) { writeToScreen("DISCONNECTED"); } function onMessage(evt) { writeToScreen('<span style="color: blue;">RESPONSE: ' + evt.data+'</span>'); websocket.close(); } function onError(evt) { writeToScreen('<span style="color: red;">ERROR:</span> ' + evt.data); } function doSend(message) { writeToScreen("SENT: " + message); websocket.send(message); } function writeToScreen(message) { var pre = document.createElement("p"); pre.style.wordWrap = "break-word"; pre.innerHTML = message; output.appendChild(pre); } window.addEventListener("load", init, false); </script> <h2>WebSocket Test</h2> <div id="output"></div>
thanks
- Edited by PBPuddin Thursday, May 22, 2014 9:38 PM
Thursday, May 22, 2014 9:25 PM
Answers
-
I'm not aware of any such samples that are already in VB.
The JavaScript snippet you quote is not using the Windows Runtime classes but is using the HTML5 WebSocket class.
C# is much closer to VB than JavaScript is and it should be significantly easier to convert the C# version of the WebSocket sample to VB, especially if you first eliminate the scenarios which don't match what you are trying to do. There are also online converters which can help. I just ran the MSDN article through one and it translated essentially the same as my hand-translated sample.
The code you translated in your previous thread looks pretty good (essentially the same as my version). In what way didn't it work? If you need help finessing it please continue in that thread.
--Rob
- Edited by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, May 22, 2014 11:05 PM
- Marked as answer by PBPuddin Friday, May 23, 2014 3:53 PM
Thursday, May 22, 2014 10:53 PMModerator -
Finally! After Weeks and weeks of trying to get this answered I was able to successfully convert a C# sample from Microsoft to vb.net. I meshed the Scenarios back into the main page code so everything is in one place and simplified somewhat. there may still be some bloat code from Microsoft's sample I'll need to remove but for now I thought I'd put it up here since no one else could provide one and maybe others would like to use it.
1. This is the vb.net code behind page for this windows 8 store app. it uses an echo server and just echos back what is sent to it.
Imports Windows.Networking.Sockets Imports Windows.Storage.Streams Imports sockettest523 Imports System Imports Windows.UI.Core Imports Windows.UI.Xaml Imports Windows.UI.Xaml.Controls Imports Windows.UI.Xaml.Navigation Imports Windows.Web ' The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 ''' <summary> ''' An empty page that can be used on its own or navigated to within a Frame. ''' </summary> Public NotInheritable Class MainPage Inherits Page Private messageWebSocket As MessageWebSocket Private messageWriter As DataWriter Private Async Function Start_Click(sender As Object, e As RoutedEventArgs) As Task Handles StartButton.Click If [String].IsNullOrEmpty(InputField.Text) Then NotifyUser("Please specify text to send", NotifyType.ErrorMessage) Return End If Dim connecting As Boolean = True Try ' Have we connected yet? If messageWebSocket Is Nothing Then ' Validating the URI is required since it was received from an untrusted source (user input). ' The URI is validated by calling TryGetUri() that will return 'false' for strings that are not ' valid WebSocket URIs. ' Note that when enabling the text box users may provide URIs to machines on the intrAnet ' or intErnet. In these cases the app requires the "Home or Work Networking" or ' "Internet (Client)" capability respectively. Dim server As Uri If Not TryGetUri(ServerAddressField.Text, server) Then Return End If NotifyUser("Connecting to: " & server.ToString, NotifyType.StatusMessage) messageWebSocket = New MessageWebSocket() messageWebSocket.Control.MessageType = SocketMessageType.Utf8 AddHandler messageWebSocket.MessageReceived, AddressOf MessageReceived AddHandler messageWebSocket.Closed, AddressOf Closed ' messageWebSocket.MessageReceived += MessageReceived() ' Dispatch close event on UI thread. This allows us to avoid synchronizing access to messageWebSocket. 'messageWebSocket.Closed += Async Function(senderSocket, args) ' Await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Function() Closed(senderSocket, args)) ' End Function Await messageWebSocket.ConnectAsync(server) messageWriter = New DataWriter(messageWebSocket.OutputStream) NotifyUser("Connected", NotifyType.StatusMessage) Else NotifyUser("Already connected", NotifyType.StatusMessage) End If connecting = False Dim message As String = InputField.Text OutputField.Text += "Sending Message:" & vbCr & vbLf & message & vbCr & vbLf ' Buffer any data we want to send. messageWriter.WriteString(message) ' Send the data as one complete message. Await messageWriter.StoreAsync() NotifyUser("Send Complete", NotifyType.StatusMessage) Catch ex As Exception ' For debugging ' Error happened during connect operation. If connecting AndAlso messageWebSocket IsNot Nothing Then messageWebSocket.Dispose() messageWebSocket = Nothing End If Dim status As WebErrorStatus = WebSocketError.GetStatus(ex.GetBaseException().HResult) Select Case status Case WebErrorStatus.CannotConnect, WebErrorStatus.NotFound, WebErrorStatus.RequestTimeout NotifyUser("Cannot connect to the server. Please make sure " & "to run the server setup script before running the sample.", NotifyType.ErrorMessage) Exit Select Case WebErrorStatus.Unknown Throw Case Else NotifyUser("Error: " & status, NotifyType.ErrorMessage) Exit Select End Select OutputField.Text += ex.Message + vbCr & vbLf End Try End Function Private Sub MessageReceived(sender As MessageWebSocket, args As MessageWebSocketMessageReceivedEventArgs) Try MarshalText(OutputField, "Message Received; Type: " & Convert.ToString(args.MessageType) & vbCr & vbLf) Using reader As DataReader = args.GetDataReader() reader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8 Dim read As String = reader.ReadString(reader.UnconsumedBufferLength) MarshalText(OutputField, read & vbCr & vbLf) End Using Catch ex As Exception ' For debugging Dim status As WebErrorStatus = WebSocketError.GetStatus(ex.GetBaseException().HResult) If status = WebErrorStatus.Unknown Then Throw End If ' Normally we'd use the status to test for specific conditions we want to handle specially, ' and only use ex.Message for display purposes. In this sample, we'll just output the ' status for debugging here, but still use ex.Message below. MarshalText(OutputField, "Error: " & status & vbCr & vbLf) MarshalText(OutputField, ex.Message + vbCr & vbLf) End Try End Sub Private Sub Close_Click(sender As Object, e As RoutedEventArgs) Try If messageWebSocket IsNot Nothing Then NotifyUser("Closing", NotifyType.StatusMessage) messageWebSocket.Close(1000, "Closed due to user request.") messageWebSocket = Nothing Else NotifyUser("No active WebSocket, send something first", NotifyType.StatusMessage) End If Catch ex As Exception Dim status As WebErrorStatus = WebSocketError.GetStatus(ex.GetBaseException().HResult) If status = WebErrorStatus.Unknown Then Throw End If ' Normally we'd use the status to test for specific conditions we want to handle specially, ' and only use ex.Message for display purposes. In this sample, we'll just output the ' status for debugging here, but still use ex.Message below. NotifyUser("Error: " & status, NotifyType.ErrorMessage) OutputField.Text += ex.Message + vbCr & vbLf End Try End Sub ' This may be triggered remotely by the server or locally by Close/Dispose() Private Sub Closed(sender As IWebSocket, args As WebSocketClosedEventArgs) MarshalText(OutputField, "Closed; Code: " & Convert.ToString(args.Code) & ", Reason: " & Convert.ToString(args.Reason) & vbCr & vbLf) If messageWebSocket IsNot Nothing Then messageWebSocket.Dispose() messageWebSocket = Nothing End If End Sub Private Sub MarshalText(output As TextBox, value As String) MarshalText(output, value, True) End Sub ' When operations happen on a background thread we have to marshal UI updates back to the UI thread. Private Sub MarshalText(output As TextBox, value As String, append As Boolean) Dim ignore = output.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, Function() If append Then output.Text += value Else output.Text = value End If End Function) End Sub Public Sub NotifyUser(strMessage As String, type As NotifyType) Select Case type Case NotifyType.StatusMessage StatusBorder.Background = New SolidColorBrush(Windows.UI.Colors.Green) Exit Select Case NotifyType.ErrorMessage StatusBorder.Background = New SolidColorBrush(Windows.UI.Colors.Red) Exit Select End Select StatusBlock.Text = strMessage ' Collapse the StatusBlock if it has no text to conserve real estate. If StatusBlock.Text <> [String].Empty Then StatusBorder.Visibility = Windows.UI.Xaml.Visibility.Visible Else StatusBorder.Visibility = Windows.UI.Xaml.Visibility.Collapsed End If End Sub Public Enum NotifyType StatusMessage ErrorMessage End Enum Public Function TryGetUri(uriString As String, ByRef uri__1 As Uri) As Boolean uri__1 = Nothing Dim webSocketUri As Uri If Not Uri.TryCreate(uriString.Trim(), UriKind.Absolute, webSocketUri) Then NotifyUser("Error: Invalid URI", NotifyType.ErrorMessage) Return False End If ' Fragments are not allowed in WebSocket URIs. If Not [String].IsNullOrEmpty(webSocketUri.Fragment) Then NotifyUser("Error: URI fragments not supported in WebSocket URIs.", NotifyType.ErrorMessage) Return False End If ' Uri.SchemeName returns the canonicalized scheme name so we can use case-sensitive, ordinal string ' comparison. If (webSocketUri.Scheme <> "ws") AndAlso (webSocketUri.Scheme <> "wss") Then NotifyUser("Error: WebSockets only support ws:// and wss:// schemes.", NotifyType.ErrorMessage) Return False End If uri__1 = webSocketUri Return True End Function End Class
2. This is the Xaml front page
<Page x:Class="sockettest523.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:sockettest523" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid.RowDefinitions> <RowDefinition Height="82*"/> <RowDefinition Height="82*"/> <RowDefinition Height="78*"/> <RowDefinition Height="91*"/> <RowDefinition Height="82*"/> <RowDefinition Height="82*"/> <RowDefinition Height="271*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="197*"/> <ColumnDefinition Width="486*"/> </Grid.ColumnDefinitions> <Button x:Name="StartButton" Content="Start" HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="5"/> <Button x:Name="CloseButton" Content="Close" Grid.Column="1" HorizontalAlignment="Left" Margin="142,40,0,0" Grid.Row="5" VerticalAlignment="Top"/> <TextBlock Grid.Column="1" TextWrapping="Wrap" Text="TextBlock"/> <TextBlock Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" Text="TextBlock"/> <TextBox x:Name="ServerAddressField" Grid.Column="1" Grid.Row="2" TextWrapping="Wrap" Text="ws://echo.websocket.org" FontSize="20"/> <TextBlock Grid.Column="1" Grid.Row="3" TextWrapping="Wrap" Text="TextBlock" FontSize="20"/> <TextBlock Grid.Row="5" TextWrapping="Wrap" Text="TextBlock" FontSize="20"/> <TextBlock x:Name="StatusBlock" Grid.Row="6" TextWrapping="Wrap" Text="TextBlock" FontSize="20"/> <Border x:Name="StatusBorder" Grid.Row="6" Grid.Column="1"> <TextBox x:Name="OutputField" Grid.Column="1" Grid.Row="6" TextWrapping="Wrap" Text="TextBox" FontSize="20" IsReadOnly="True"/> </Border> <TextBox x:Name="InputField" Grid.Column="1" Grid.Row="4" TextWrapping="Wrap" Text="TextBox" FontSize="20"/> </Grid> </Page>
this is all on Microsoft's visual studio express 2013 for windows. there are no special references for this and the appxmanifest only has the Default Internet(client) capabilities set. I may need this changed fro true two way socket I'm not sure yet.
Also the server used is NOT on localhost and is available to anyone so this takes any issues about the server out of the equation. Now I need to get a basic server going for myself so I can customize that
- Marked as answer by PBPuddin Friday, May 23, 2014 3:52 PM
Friday, May 23, 2014 3:52 PM
All replies
-
I'm not aware of any such samples that are already in VB.
The JavaScript snippet you quote is not using the Windows Runtime classes but is using the HTML5 WebSocket class.
C# is much closer to VB than JavaScript is and it should be significantly easier to convert the C# version of the WebSocket sample to VB, especially if you first eliminate the scenarios which don't match what you are trying to do. There are also online converters which can help. I just ran the MSDN article through one and it translated essentially the same as my hand-translated sample.
The code you translated in your previous thread looks pretty good (essentially the same as my version). In what way didn't it work? If you need help finessing it please continue in that thread.
--Rob
- Edited by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, May 22, 2014 11:05 PM
- Marked as answer by PBPuddin Friday, May 23, 2014 3:53 PM
Thursday, May 22, 2014 10:53 PMModerator -
Finally! After Weeks and weeks of trying to get this answered I was able to successfully convert a C# sample from Microsoft to vb.net. I meshed the Scenarios back into the main page code so everything is in one place and simplified somewhat. there may still be some bloat code from Microsoft's sample I'll need to remove but for now I thought I'd put it up here since no one else could provide one and maybe others would like to use it.
1. This is the vb.net code behind page for this windows 8 store app. it uses an echo server and just echos back what is sent to it.
Imports Windows.Networking.Sockets Imports Windows.Storage.Streams Imports sockettest523 Imports System Imports Windows.UI.Core Imports Windows.UI.Xaml Imports Windows.UI.Xaml.Controls Imports Windows.UI.Xaml.Navigation Imports Windows.Web ' The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 ''' <summary> ''' An empty page that can be used on its own or navigated to within a Frame. ''' </summary> Public NotInheritable Class MainPage Inherits Page Private messageWebSocket As MessageWebSocket Private messageWriter As DataWriter Private Async Function Start_Click(sender As Object, e As RoutedEventArgs) As Task Handles StartButton.Click If [String].IsNullOrEmpty(InputField.Text) Then NotifyUser("Please specify text to send", NotifyType.ErrorMessage) Return End If Dim connecting As Boolean = True Try ' Have we connected yet? If messageWebSocket Is Nothing Then ' Validating the URI is required since it was received from an untrusted source (user input). ' The URI is validated by calling TryGetUri() that will return 'false' for strings that are not ' valid WebSocket URIs. ' Note that when enabling the text box users may provide URIs to machines on the intrAnet ' or intErnet. In these cases the app requires the "Home or Work Networking" or ' "Internet (Client)" capability respectively. Dim server As Uri If Not TryGetUri(ServerAddressField.Text, server) Then Return End If NotifyUser("Connecting to: " & server.ToString, NotifyType.StatusMessage) messageWebSocket = New MessageWebSocket() messageWebSocket.Control.MessageType = SocketMessageType.Utf8 AddHandler messageWebSocket.MessageReceived, AddressOf MessageReceived AddHandler messageWebSocket.Closed, AddressOf Closed ' messageWebSocket.MessageReceived += MessageReceived() ' Dispatch close event on UI thread. This allows us to avoid synchronizing access to messageWebSocket. 'messageWebSocket.Closed += Async Function(senderSocket, args) ' Await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Function() Closed(senderSocket, args)) ' End Function Await messageWebSocket.ConnectAsync(server) messageWriter = New DataWriter(messageWebSocket.OutputStream) NotifyUser("Connected", NotifyType.StatusMessage) Else NotifyUser("Already connected", NotifyType.StatusMessage) End If connecting = False Dim message As String = InputField.Text OutputField.Text += "Sending Message:" & vbCr & vbLf & message & vbCr & vbLf ' Buffer any data we want to send. messageWriter.WriteString(message) ' Send the data as one complete message. Await messageWriter.StoreAsync() NotifyUser("Send Complete", NotifyType.StatusMessage) Catch ex As Exception ' For debugging ' Error happened during connect operation. If connecting AndAlso messageWebSocket IsNot Nothing Then messageWebSocket.Dispose() messageWebSocket = Nothing End If Dim status As WebErrorStatus = WebSocketError.GetStatus(ex.GetBaseException().HResult) Select Case status Case WebErrorStatus.CannotConnect, WebErrorStatus.NotFound, WebErrorStatus.RequestTimeout NotifyUser("Cannot connect to the server. Please make sure " & "to run the server setup script before running the sample.", NotifyType.ErrorMessage) Exit Select Case WebErrorStatus.Unknown Throw Case Else NotifyUser("Error: " & status, NotifyType.ErrorMessage) Exit Select End Select OutputField.Text += ex.Message + vbCr & vbLf End Try End Function Private Sub MessageReceived(sender As MessageWebSocket, args As MessageWebSocketMessageReceivedEventArgs) Try MarshalText(OutputField, "Message Received; Type: " & Convert.ToString(args.MessageType) & vbCr & vbLf) Using reader As DataReader = args.GetDataReader() reader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8 Dim read As String = reader.ReadString(reader.UnconsumedBufferLength) MarshalText(OutputField, read & vbCr & vbLf) End Using Catch ex As Exception ' For debugging Dim status As WebErrorStatus = WebSocketError.GetStatus(ex.GetBaseException().HResult) If status = WebErrorStatus.Unknown Then Throw End If ' Normally we'd use the status to test for specific conditions we want to handle specially, ' and only use ex.Message for display purposes. In this sample, we'll just output the ' status for debugging here, but still use ex.Message below. MarshalText(OutputField, "Error: " & status & vbCr & vbLf) MarshalText(OutputField, ex.Message + vbCr & vbLf) End Try End Sub Private Sub Close_Click(sender As Object, e As RoutedEventArgs) Try If messageWebSocket IsNot Nothing Then NotifyUser("Closing", NotifyType.StatusMessage) messageWebSocket.Close(1000, "Closed due to user request.") messageWebSocket = Nothing Else NotifyUser("No active WebSocket, send something first", NotifyType.StatusMessage) End If Catch ex As Exception Dim status As WebErrorStatus = WebSocketError.GetStatus(ex.GetBaseException().HResult) If status = WebErrorStatus.Unknown Then Throw End If ' Normally we'd use the status to test for specific conditions we want to handle specially, ' and only use ex.Message for display purposes. In this sample, we'll just output the ' status for debugging here, but still use ex.Message below. NotifyUser("Error: " & status, NotifyType.ErrorMessage) OutputField.Text += ex.Message + vbCr & vbLf End Try End Sub ' This may be triggered remotely by the server or locally by Close/Dispose() Private Sub Closed(sender As IWebSocket, args As WebSocketClosedEventArgs) MarshalText(OutputField, "Closed; Code: " & Convert.ToString(args.Code) & ", Reason: " & Convert.ToString(args.Reason) & vbCr & vbLf) If messageWebSocket IsNot Nothing Then messageWebSocket.Dispose() messageWebSocket = Nothing End If End Sub Private Sub MarshalText(output As TextBox, value As String) MarshalText(output, value, True) End Sub ' When operations happen on a background thread we have to marshal UI updates back to the UI thread. Private Sub MarshalText(output As TextBox, value As String, append As Boolean) Dim ignore = output.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, Function() If append Then output.Text += value Else output.Text = value End If End Function) End Sub Public Sub NotifyUser(strMessage As String, type As NotifyType) Select Case type Case NotifyType.StatusMessage StatusBorder.Background = New SolidColorBrush(Windows.UI.Colors.Green) Exit Select Case NotifyType.ErrorMessage StatusBorder.Background = New SolidColorBrush(Windows.UI.Colors.Red) Exit Select End Select StatusBlock.Text = strMessage ' Collapse the StatusBlock if it has no text to conserve real estate. If StatusBlock.Text <> [String].Empty Then StatusBorder.Visibility = Windows.UI.Xaml.Visibility.Visible Else StatusBorder.Visibility = Windows.UI.Xaml.Visibility.Collapsed End If End Sub Public Enum NotifyType StatusMessage ErrorMessage End Enum Public Function TryGetUri(uriString As String, ByRef uri__1 As Uri) As Boolean uri__1 = Nothing Dim webSocketUri As Uri If Not Uri.TryCreate(uriString.Trim(), UriKind.Absolute, webSocketUri) Then NotifyUser("Error: Invalid URI", NotifyType.ErrorMessage) Return False End If ' Fragments are not allowed in WebSocket URIs. If Not [String].IsNullOrEmpty(webSocketUri.Fragment) Then NotifyUser("Error: URI fragments not supported in WebSocket URIs.", NotifyType.ErrorMessage) Return False End If ' Uri.SchemeName returns the canonicalized scheme name so we can use case-sensitive, ordinal string ' comparison. If (webSocketUri.Scheme <> "ws") AndAlso (webSocketUri.Scheme <> "wss") Then NotifyUser("Error: WebSockets only support ws:// and wss:// schemes.", NotifyType.ErrorMessage) Return False End If uri__1 = webSocketUri Return True End Function End Class
2. This is the Xaml front page
<Page x:Class="sockettest523.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:sockettest523" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid.RowDefinitions> <RowDefinition Height="82*"/> <RowDefinition Height="82*"/> <RowDefinition Height="78*"/> <RowDefinition Height="91*"/> <RowDefinition Height="82*"/> <RowDefinition Height="82*"/> <RowDefinition Height="271*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="197*"/> <ColumnDefinition Width="486*"/> </Grid.ColumnDefinitions> <Button x:Name="StartButton" Content="Start" HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="5"/> <Button x:Name="CloseButton" Content="Close" Grid.Column="1" HorizontalAlignment="Left" Margin="142,40,0,0" Grid.Row="5" VerticalAlignment="Top"/> <TextBlock Grid.Column="1" TextWrapping="Wrap" Text="TextBlock"/> <TextBlock Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" Text="TextBlock"/> <TextBox x:Name="ServerAddressField" Grid.Column="1" Grid.Row="2" TextWrapping="Wrap" Text="ws://echo.websocket.org" FontSize="20"/> <TextBlock Grid.Column="1" Grid.Row="3" TextWrapping="Wrap" Text="TextBlock" FontSize="20"/> <TextBlock Grid.Row="5" TextWrapping="Wrap" Text="TextBlock" FontSize="20"/> <TextBlock x:Name="StatusBlock" Grid.Row="6" TextWrapping="Wrap" Text="TextBlock" FontSize="20"/> <Border x:Name="StatusBorder" Grid.Row="6" Grid.Column="1"> <TextBox x:Name="OutputField" Grid.Column="1" Grid.Row="6" TextWrapping="Wrap" Text="TextBox" FontSize="20" IsReadOnly="True"/> </Border> <TextBox x:Name="InputField" Grid.Column="1" Grid.Row="4" TextWrapping="Wrap" Text="TextBox" FontSize="20"/> </Grid> </Page>
this is all on Microsoft's visual studio express 2013 for windows. there are no special references for this and the appxmanifest only has the Default Internet(client) capabilities set. I may need this changed fro true two way socket I'm not sure yet.
Also the server used is NOT on localhost and is available to anyone so this takes any issues about the server out of the equation. Now I need to get a basic server going for myself so I can customize that
- Marked as answer by PBPuddin Friday, May 23, 2014 3:52 PM
Friday, May 23, 2014 3:52 PM -
You gave me one vital piece of info in this post which I didn't realize. "Scenarios" I've never used them in my programming and the fact that Microsoft Decided to use them in there sample was a bad move in my eyes. While I understand they probably did it to allow them to show two techniques in one sample. it makes it that much more difficult to determine which code you need from the main page and which you need from the scenario. Once I realized that's what they were doing (due to your post) I was able to find the missing code that was causing me issues for the last weeks.
Thanks again.
Friday, May 23, 2014 3:57 PM