---
title: roUPnPSearchEvent
slug: develop/roupnpsearchevent
docTags: 
createdAt: 2025-03-26T17:42:10.819Z
---

This event object is returned when there is a response to a *roUPnPController.Search()&#x20;*&#x6F;peration. It is also returned when the *roUPnPController&#x20;*&#x6F;bject receives multicast UDP SSDP messages.

## ifUPnPSearchEvent

**GetObject() As Object**

Returns either an roUPnPDevice or an roAssociativeArray instance, depending on the value returned from the GetType() method.

**GetType() As Integer**

Returns an integer value indicating the type of response:

- 0 (Advertisement) – Indicates the receipt of an SSDP multicast message, which can be either a NOTIFY message or an M-SEARCH message. The `GetObject()` method will return an associative array with all SSDP headers and an "ssdpType" key, which can have a value of either "m-search" or "notify".
- 1 (Search response) – Indicates that the message is a response to an *roUPnPControllor.Search()&#x20;*&#x72;equest. The `GetObject()` method will return an associative array with all headers from the HTTP M-SEARCH response.
- 2 (New device added to the device list) – Indicates that the *roUPnPController&#x20;*&#x6F;bject has detected a new device and added it to the device list, which is maintained internally. Device detection can result from receiving either an `ssdp:alive` message or a response to an M-SEARCH message. The `GetObject()` method will return an *roUPnPDevice&#x20;*&#x69;nstance containing information about the added device. This message type is only delivered once per new device. Once a device is part of the device list, subsequent M-SEARCH requests will only return type 1 (Search response) values for that device.
- 3 (Device will be deleted from the device list) – Indicates that a device will be deleted from the device list, which is maintained internally. A device is deleted from the list when the player receives an ssdp\:byebye message from the device, when the device does not send an `ssdp:alive` message within the defined "max-age" interval, or when the device is forcibly removed using the *roUPnPController.RemoveDevice()&#x20;*&#x6D;ethod. The `GetObject()` method will return an *roUPnPDevice&#x20;*&#x69;nstance containing information about the device to be removed.

## ifUserData

**SetUserData(user\_data As Object)**

Sets the user data that will be returned when events are raised.

**GetUserData() As Object**

Returns the user data that has previously been set via `SetUserData()`. It will return Invalid if no data has been set.

