Class: SenderDisconnectedEvent
Stay organized with collections
Save and categorize content based on your preferences.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["\u003cp\u003e\u003ccode\u003eSenderDisconnectedEvent\u003c/code\u003e is dispatched when a sender (like a phone or laptop) disconnects from the Cast receiver.\u003c/p\u003e\n"],["\u003cp\u003eIt provides information about the disconnection, including the sender's ID, user agent, and the reason for disconnection.\u003c/p\u003e\n"],["\u003cp\u003eThis event extends the base \u003ccode\u003eEvent\u003c/code\u003e class and includes properties like \u003ccode\u003ereason\u003c/code\u003e, \u003ccode\u003esenderId\u003c/code\u003e, \u003ccode\u003etype\u003c/code\u003e, and \u003ccode\u003euserAgent\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use this event to handle scenarios like pausing content or cleaning up resources when a sender disconnects.\u003c/p\u003e\n"]]],["The `SenderDisconnectedEvent` class, dispatched by `CastReceiverContext`, signals when a sender disconnects. This event provides details about the disconnection, including the `senderId` (ID of the disconnected sender), `userAgent` (sender's user agent), and `reason` (the cause of disconnection, which cannot be null). The `type` property indicates the event type and is inherited. It extends the `Event` class. The event is created by invoking a new instance of `SenderDisconnectedEvent` and passing the parameters.\n"],null,["# Class: SenderDisconnectedEvent\n\ncast.[framework](/cast/docs/reference/web_receiver/cast.framework).[system](/cast/docs/reference/web_receiver/cast.framework.system).SenderDisconnectedEvent\n============================================================================================================================================================\n\nclass static\n\nAn event dispatched by [cast.framework.CastReceiverContext](/cast/docs/reference/web_receiver/cast.framework.CastReceiverContext) when a\nsender is disconnected.\n\nConstructor\n-----------\n\n### SenderDisconnectedEvent\n\nnew\nSenderDisconnectedEvent(senderId, userAgent, reason)\n\n| #### Parameter ||\n|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| senderId | string The sender ID. |\n| userAgent | string The user agent. |\n| reason | [cast.framework.system.DisconnectReason](/cast/docs/reference/web_receiver/cast.framework.system#.DisconnectReason) The reason the sender was disconnected. Value must not be null. |\n\nExtends\n: [cast.framework.system.Event](/cast/docs/reference/web_receiver/cast.framework.system.Event)\n\nProperties\n----------\n\n### reason\n\nnon-null [cast.framework.system.DisconnectReason](/cast/docs/reference/web_receiver/cast.framework.system#.DisconnectReason)\n\nThe reason the sender was disconnected.\n\n### senderId\n\nstring\n\nThe ID of the disconnected sender.\n\n### type\n\nnon-null [cast.framework.system.EventType](/cast/docs/reference/web_receiver/cast.framework.system#.EventType)\n\nThe event type.\n\nInherited from\n: [cast.framework.system.Event#type](/cast/docs/reference/web_receiver/cast.framework.system.Event#type)\n\n### userAgent\n\nstring\n\nThe user agent of the sender."]]