# What is the lifetime of IOnlineSubsystem and it's SessionInterface?

**URL:** <https://forums.unrealengine.com/t/what-is-the-lifetime-of-ionlinesubsystem-and-its-sessioninterface/369715>\
**Category:** Mobile\
**Tags:** fyi, online-subsystem-ove, unreal-engine, question\
**Created:** [September 7, 2016, 8:19pm UTC](https://forums.unrealengine.com/t/what-is-the-lifetime-of-ionlinesubsystem-and-its-sessioninterface/369715 "2016-09-07T20:19:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [September 7, 2016, 8:19pm UTC](https://forums.unrealengine.com/t/what-is-the-lifetime-of-ionlinesubsystem-and-its-sessioninterface/369715/1 "2016-09-07T20:19:01Z")

</div>

What are the lifetimes of these online system objects? I’m working on a basic lobby manager class, and looking at ShooterGame for some examples. ShooterGame is constantly checking to see if they are valid. If I check once during initialization, can I be guaranteed that they will be around for the lifetime of my GameInstance object?

---

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [September 7, 2016, 8:19pm UTC](https://forums.unrealengine.com/t/what-is-the-lifetime-of-ionlinesubsystem-and-its-sessioninterface/369715/2 "2016-09-07T20:19:10Z")

</div>

Hi Brock,

ShooterGame is just being safe with the validity checks. It’s always possible that a call to `IOnlineSubsystem::Get()` could return null if no OSS modules are found, which can happen if they’re not compiled in to your project (such as if don’t specify dependencies in Build.cs files). If you can guarantee that an appropriate OSS module will exist for your project, it should be valid for the entire time between calls to `FOnlineSubsystemModule::GetOnlineSubsystem()` (called by `IOnlineSubsystem::Get()`) and `FOnlineSubsystemModule::DestroyOnlineSubsystem()` (called by `IOnlineSubsystem::Destroy()` and `IOnlineSubsystem::ReloadDefaultSubsystem()`).

The pattern for the standard OSS implementations is to create their interface objects (including the session interface) in their `Init()` function and destroy them in their `Shutdown()` function. Just be careful because not all subsystems may implement every interface, and I can’t guarantee that all future and/or third-party OSS implementations will continue to follow the same pattern.
