Pode icon indicating copy to clipboard operation
Pode copied to clipboard

Using Connect-PodeWebSocket

Open svivier-gp-aviva opened this issue 3 years ago • 1 comments

Describe the Bug

Calling Connect-PodeWebSocket -Name 'xxx' -Url 'ws://localhost:8091' -ScriptBlock { } make an exception on Receivers (from $PodeContext) because this property is not found.

The Pode WebSocket server is responding when calling from outside (using https://hoppscotch.io/realtime/websocket).

Steps To Reproduce

Steps to reproduce the behavior:

  1. Using Connect-PodeWebSocket -Name 'CODIR' -Url 'ws://localhost:8091' -ScriptBlock { }
  2. Error occur : Date: 2022-09-29 15:05:31 Level: Error ThreadId: 5 Server: VLB-PC-SPARE01 Category: NotSpecified: (:) [], SetValueInvocationException Message: Exception lors de la définition de « Receivers » : « La propriété « Receivers » est introuvable dans cet objet. Vérifiez qu’elle existe et qu’elle peut être définie. » StackTrace: à New-PodeWebSocketReceiver, C:\Program Files\WindowsPowerShell\Modules\Pode\2.7.1\Private\WebSockets.ps1 : ligne 30 à Connect-PodeWebSocket, C:\Program Files\WindowsPowerShell\Modules\Pode\2.7.1\Public\WebSockets.ps1 : ligne 117 à <ScriptBlock>, C:\Dev\AvAdmin\gui\CODIR\SATCLI.ps1 : ligne 28 à Invoke-PodeScriptBlock, C:\Program Files\WindowsPowerShell\Modules\Pode\2.7.1\Public\Utilities.ps1 : ligne 642 à <ScriptBlock>, <Aucun fichier> : ligne 6 à Invoke-PodeScriptBlock, C:\Program Files\WindowsPowerShell\Modules\Pode\2.7.1\Public\Utilities.ps1 : ligne 634 à <ScriptBlock>, <Aucun fichier> : ligne 106

Platform

  • OS: Windows 10
  • Browser: Firefox
  • Versions:
    • Pode: 1.7.2
    • PowerShell: 5.2

svivier-gp-aviva avatar Sep 29 '22 13:09 svivier-gp-aviva

Hi @svivier-gp-aviva,

Where are you calling Connect-PodeWebSocket? Before Start-PodeWebServer, inside Start-PodeWebServer, or inside another scriptblock such as a Route, Timer, etc.?

Badgerati avatar Oct 04 '22 21:10 Badgerati