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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="chanon" data-post="11" data-topic="22737">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chanon/48/13215_2.png" class="avatar"> chanon:</div>
<blockquote>
<p>Does websocket frame size mean the same thing as request size? I remember something about large requests being able to be separated into multiple frames</p>
</blockquote>
</aside>
<p>Good point. I forgot about this when I suggested it. <a href="https://ninenines.eu/docs/en/cowboy/2.6/manual/cowboy_websocket/" rel="noopener nofollow ugc">Cowboy’s function reference docs</a> suggest it may do what you want, though:</p>
<blockquote>
<p>max_frame_size (infinity)</p>
<p>Maximum frame size allowed by this Websocket handler. Cowboy will close the connection when a client attempts to send a frame that goes over this limit. <strong>For fragmented frames this applies to the size of the reconstituted frame.</strong></p>
</blockquote>
<p>Best to test for the expected behavior before relying on it in production. Cheers.</p>
<p><em>EDIT:</em> Is frame fragmentation different than multiple frames per message? I’m not sure.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130090" data-batch-url="/posts/batch_likers">
                        2
                      </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/ensuring-user-input-isnt-too-large/22737/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-130090" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130090"
                     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="130251" data-post-id="130251">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="jmitchell" data-post="12" data-topic="22737">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jmitchell/48/3435_2.png" class="avatar"> jmitchell:</div>
<blockquote>
<p>Is frame fragmentation different than multiple frames per message?</p>
</blockquote>
</aside>
<p>RFC 6455, <a href="https://tools.ietf.org/html/rfc6455#section-1.2" rel="noopener nofollow ugc">section 1.2</a> says:</p>
<blockquote>
<p>The WebSocket message does not necessarily correspond to a particular network layer framing, as a fragmented message may be coalesced or split by an intermediary.</p>
</blockquote>
<p><a href="https://tools.ietf.org/html/rfc6455#section-10.4" rel="noopener nofollow ugc">Section 10.4</a> addresses implementation-specific limits:</p>
<blockquote>
<p>Implementations that have implementation- and/or platform-specific limitations regarding the frame size or total message size after reassembly from multiple frames MUST protect themselves against exceeding those limits.  (For example, a malicious endpoint can try to exhaust its peer’s memory or mount a denial-of-service attack by sending either a single big frame (e.g., of size 2**60) or by sending a long stream of small frames that are a part of a fragmented message.)  Such an implementation SHOULD impose a limit on frame sizes and the total message size after reassembly from multiple frames.</p>
</blockquote>
<p><a href="https://tools.ietf.org/html/rfc6455#section-5.2" rel="noopener nofollow ugc">Section 5.2</a> shows that frames have a <code>FIN</code> bit which:</p>
<blockquote>
<p>Indicates that this is the final fragment in a message.  The first fragment MAY also be the final fragment.</p>
</blockquote>
<p>Fields about payload length only pertain to one frame/fragment. To determine the length of the message the receiver must consume frames until reaching one where <code>FIN == 1</code> and then sum the payload lengths of all those fragments. Given the concern raised in 10.4 about malicious endpoints, an implementation shouldn’t actually concatenate all the fragment payloads into a message if it would exceed the implementation-defined limit; otherwise, it would have to temporarily store an arbitrarily long sequence of potentially large payloads.</p>
<p>After reading some of the <code>cowboy</code> code I think <code>max_frame_size</code> applies both to <a href="https://github.com/ninenines/cowboy/blob/dfeec3b74ad09c9d3eb4cab9910c5dba6f5e2cd5/src/cowboy_websocket.erl#L393-L394" rel="noopener nofollow ugc">individual frames</a> and the accumulated payloads from a <a href="https://github.com/ninenines/cowboy/blob/dfeec3b74ad09c9d3eb4cab9910c5dba6f5e2cd5/src/cowboy_websocket.erl#L434-L438" rel="noopener nofollow ugc">sequence of fragments for the same message</a>.</p>
<p>Fair warning: I haven’t tested it, and I only recently started reading this code.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130251" data-batch-url="/posts/batch_likers">
                        2
                      </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/ensuring-user-input-isnt-too-large/22737/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-130251" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130251"
                     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="130280" data-post-id="130280">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chanon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chanon/120/13215_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chanon
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Wow! Thanks for the in-depth research to get to the bottom of this <img src="https://forum.elixirforum.com/images/emoji/apple/grinning.png?v=15" title=":grinning:" class="emoji" alt=":grinning:" loading="lazy" width="20" height="20">!!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="130280" data-batch-url="/posts/batch_likers">
                        2
                      </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/ensuring-user-input-isnt-too-large/22737/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-130280" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="130280"
                     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>