Legacy Documentation: Version 2017.2 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ConnectionConfig.WebSocketReceiveBufferMaxSize

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public var WebSocketReceiveBufferMaxSize: ushort;
public ushort WebSocketReceiveBufferMaxSize;

Description

WebSocket only. Defines the buffer size in bytes for received frames on a WebSocket host. If this value is 0 (the default), a 4 kilobyte buffer is used. Any other value results in a buffer of that size, in bytes.

WebSocket message fragments are called "frames". A WebSocket host has a buffer to store incoming message frames. Therefore this buffer should be set to the largest legal frame size supported. If an incoming frame exceeds the buffer size, no error is reported. However, the buffer will invoke the user callback in order to create space for the overflow.

no example available in JavaScript
using UnityEngine;
using UnityEngine.Networking;

public class ExampleScript : NetworkBehaviour { void Start() { ConnectionConfig myConfig = new ConnectionConfig(); myConfig.AddChannel(QosType.Unreliable); myConfig.AddChannel(QosType.UnreliableFragmented); myConfig.WebSocketReceiveBufferMaxSize = 8192; //~8k } }

Did you find this page useful? Please give it a rating: