Skip to content

Send-PodeSseEvent

SYNOPSIS

Send an Event to one or more SSE connections.

SYNTAX

Name

Send-PodeSseEvent -Name <String> [-Group <String[]>] [-ClientId <String[]>] [-Id <String>]
 [-EventType <String>] -Data <Object> [-Depth <Int32>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

WebEvent

Send-PodeSseEvent [-Id <String>] [-EventType <String>] -Data <Object> [-Depth <Int32>] [-FromEvent]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Send an Event to one or more SSE connections. This can either be: - Every client for an SSE connection Name - Specific ClientIds for an SSE connection Name - The current SSE connection being referenced within $WebEvent.Sse

EXAMPLES

EXAMPLE 1

Send-PodeSseEvent -FromEvent -Data 'This is an event'

EXAMPLE 2

Send-PodeSseEvent -FromEvent -Data @{ Message = 'A message' }

EXAMPLE 3

Send-PodeSseEvent -Name 'Actions' -Data @{ Message = 'A message' }

EXAMPLE 4

Send-PodeSseEvent -Name 'Actions' -Group 'admins' -Data @{ Message = 'A message' }

EXAMPLE 5

Send-PodeSseEvent -Name 'Actions' -Data @{ Message = 'A message' } -ID 123 -EventType 'action'

PARAMETERS

-ClientId

An optional array of 1 or more SSE connection ClientIds to send Events to, for the specified SSE connection Name.

Type: String[]
Parameter Sets: Name
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Data

The Data for the Event being sent, either as a String or a Hashtable/PSObject. If the latter, it will be converted into JSON.

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Depth

The Depth to generate the JSON document - the larger this value the worse performance gets.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 10
Accept pipeline input: False
Accept wildcard characters: False

-EventType

An optional EventType for the Event being sent.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FromEvent

If supplied, the SSE connection Name and ClientId will atttempt to be retrived from $WebEvent.Sse. These details will be set if ConvertTo-PodeSseConnection has just been called. Or if X-PODE-SSE-CLIENT-ID and X-PODE-SSE-NAME are set on an HTTP request.

Type: SwitchParameter
Parameter Sets: WebEvent
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Group

An optional array of 1 or more SSE connection Groups to send Events to, for the specified SSE connection Name.

Type: String[]
Parameter Sets: Name
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Id

An optional ID for the Event being sent.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

An SSE connection Name.

Type: String
Parameter Sets: Name
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES