<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="149665" data-post-id="149665">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="l00ker" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/l00ker/120/4095_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  l00ker
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>There are 3rd party Phoenix <a href="https://hexdocs.pm/phoenix/channels.html#client-libraries" rel="noopener nofollow ugc">client libraries</a> available:</p>
<ul>
<li>Swift (iOS)
<ul>
<li><a href="https://github.com/davidstump/SwiftPhoenixClient" rel="noopener nofollow ugc">SwiftPhoenix</a></li>
</ul>
</li>
<li>Java (Android)
<ul>
<li><a href="https://github.com/eoinsha/JavaPhoenixChannels" rel="noopener nofollow ugc">JavaPhoenixChannels</a></li>
</ul>
</li>
<li>C#
<ul>
<li><a href="https://github.com/Mazyod/PhoenixSharp" rel="noopener nofollow ugc">PhoenixSharp</a></li>
<li><a href="https://github.com/jfis/dn-phoenix" rel="noopener nofollow ugc">dn-phoenix</a></li>
</ul>
</li>
<li>Elixir
<ul>
<li><a href="https://github.com/Aircloak/phoenix_gen_socket_client" rel="noopener nofollow ugc">phoenix_gen_socket_client</a></li>
</ul>
</li>
<li>GDScript (Godot Game Engine)
<ul>
<li><a href="https://github.com/alfredbaudisch/GodotPhoenixChannels" rel="noopener nofollow ugc">GodotPhoenixChannels</a></li>
</ul>
</li>
</ul>
<p>Maybe one of these will be of use.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="149665" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-keep-the-connection-alive-in-phoenix-socket-for-mobile-app/26658/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-149665" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="149665"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="193104" data-post-id="193104">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="theagilecoder" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  theagilecoder
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Is there any library I can use for a react native app ? I want to connect my react native app with a Phoenix channel.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193104" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-keep-the-connection-alive-in-phoenix-socket-for-mobile-app/26658/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-193104" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193104"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="193106" data-post-id="193106">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="outlog" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  outlog
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>in react native use the standard phoenix.js - <a href="https://github.com/phoenixframework/phoenix/blob/master/assets/js/phoenix.js" rel="noopener nofollow ugc">https://github.com/phoenixframework/phoenix/blob/master/assets/js/phoenix.js</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193106" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-keep-the-connection-alive-in-phoenix-socket-for-mobile-app/26658/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-193106" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193106"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="193107" data-post-id="193107">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="theagilecoder" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  theagilecoder
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks, I will use phoenix.js then! I was wondering - will Android keep the client on for a longer duration than 30 minutes ? WIll it not kill it / sleep it for battery optimization ? For a use case, I need the client connected to phoenix socket for 2 hours.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193107" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-keep-the-connection-alive-in-phoenix-socket-for-mobile-app/26658/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-193107" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193107"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="193108" data-post-id="193108">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="outlog" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  outlog
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>in the foreground connection is kept forever..</p>
<p>in my experience android keeps the websocket going in the background, for how long I don’t know - might have changed depending on your android version etc etc.<br>
(ios kills the connection when backgrounded after 10-15 secs)</p>
<p>In my react native app I have calls doing a disconnect when the app is backgrounded, and connect again when it’s resumed..</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193108" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-keep-the-connection-alive-in-phoenix-socket-for-mobile-app/26658/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-193108" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193108"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="193109" data-post-id="193109">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="theagilecoder" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  theagilecoder
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for the response! Keeping the app in foreground for 2 hours would mean keeping the screen on for 2 hours and that will kill the battery <img src="https://forum.elixirforum.com/images/emoji/apple/frowning.png?v=15" title=":frowning:" class="emoji" alt=":frowning:" loading="lazy" width="20" height="20"> . As per my observation, i think android kills it in 30 mins or so. <img src="https://forum.elixirforum.com/images/emoji/apple/frowning.png?v=15" title=":frowning:" class="emoji" alt=":frowning:" loading="lazy" width="20" height="20"></p>
<p>Connect when resumed would not work for me because I wish to receive message from phoenix socket 1 or 2 hours after joining and then showing a notification, all this while the app is in background and phone screen locked. Anyway, I will try and see what happens.</p>
<p>Now I am wondering is it even possible to build a react native app that shows notification many hours after joining a socket, even when the app is in background and screen is off. (Like chat apps - they show notification upon receiving a message even when they are dead)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193109" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-keep-the-connection-alive-in-phoenix-socket-for-mobile-app/26658/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-193109" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193109"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="193110" data-post-id="193110">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="outlog" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  outlog
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>sounds like push notifications is the correct tool for solving that (for various reasons - namely battery life and simplicity)</p>
<p><a href="https://github.com/zo0r/react-native-push-notification" class="inline-onebox" rel="noopener nofollow ugc">GitHub - zo0r/react-native-push-notification: React Native Local and Remote Notifications · GitHub</a> - and <a href="https://hex.pm/packages/pigeon" class="inline-onebox" rel="nofollow">pigeon | Hex</a> should get you there.. or you can use <a href="https://onesignal.com" rel="noopener nofollow ugc">https://onesignal.com</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193110" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-keep-the-connection-alive-in-phoenix-socket-for-mobile-app/26658/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-193110" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193110"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="193111" data-post-id="193111">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="theagilecoder" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  theagilecoder
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Actually, I have tried react-native-push-notification in a react native app that didnt have a back-end and it didnt work as expected when screen is turned off. Android just pauses the handy timer function included in react-native-push-notification until it is back in foreground. I will try the other 2 packages.</p>
<p>Pigeon seem to work only with native apps. Ill have a look.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193111" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-keep-the-connection-alive-in-phoenix-socket-for-mobile-app/26658/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-193111" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193111"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>