Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active November 2, 2021 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/3e0679b0dcad9129156e89304aa0fc73 to your computer and use it in GitHub Desktop.
Save bjoerntx/3e0679b0dcad9129156e89304aa0fc73 to your computer and use it in GitHub Desktop.
@using TXTextControl.Web.MVC
@{
Random rand = new Random();
string serverId = rand.Next(0, 2).ToString();
// build WebSocketURL including a server id in query string
var sProtocol = (Context.Request.IsHttps) ? "wss://" : "ws://";
var sWebSocketURL = sProtocol + Context.Request.Host
+ "/TXWebSocket?server=" + serverId;
}
@Html.TXTextControl().TextControl(settings => {
settings.WebSocketURL = sWebSocketURL;
}).Render()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment