Products Technologies Demo Docs Blog Support Company

TX Text Control Document Editor Deployment Strategies

The TX Text Control document editor requires a server-side backend to synchronize the edited documents. This article gives an overview of best practices deployment strategies.

TX Text Control Document Editor Deployment Strategies

The TX Text Control document editor requires 3 components:

  1. Client-side package (ASP.NET NuGet, Angular npm)
  2. Server-side WebSocketHandler (Node.js or ASP.NET on Linux or Windows)
  3. Document Synchronization TCP Service (Windows)

To synchronize the document and to provide the true WYSIWYG rendering, the client-side component opens a WebSocket connection to the WebSocketHandler. This can be an ASP.NET (Core) Web Application or a Node.js package that is hosted on Windows or Linux. The third required component is the synchronization service that must be hosted on a Windows machine. Thanks to the flexible setup, these 3 components can be deployed independently.

Scenario 1: All components on Windows

The first scenario is the easiest: All required components are hosted on the same Windows machine. Your ASP.NET (Core) Web Application acts additionally as the required backend for the document editor. The used client-side package (Angular or ASP.NET) is connecting directly to the WebSocketHandler (WebSocketMiddleware) in your ASP.NET backend. The ASP.NET backend is connecting to the TCP Windows Service on the same machine automatically.

TX Text Control Deployment Scenario

Pros and Cons

The following table lists the advantages and potential disadvantages of this deployment strategy.

Advantages
Easy deployment (all on the same instance)
Shortest possible distance to TCP Service
Disadvantages
Windows Server only

Required Settings

No specific settings are required. This scenario is the default strategy and works without any settings.

Getting Started

This tutorial shows how to create this scenario:

ASP.NET Core Document Editor

Scenario 2: Separated TCP Service

In this scenario, the WebSocketHandler is hosted on any server (Linux or Windows) and your web application can be deployed as usual without any dependency on Windows. A separate Windows server is required to host the Document Synchronization TCP Service that is communicating with the WebSocketHandler using TCP.

TX Text Control Deployment Scenario

Pros and Cons

The following table lists the advantages and potential disadvantages of this deployment strategy.

Advantages
Deployment to any server platform
No change to your normal deployment strategy
Independently maintained instance for TCP service
Easy scaling (load balancing)

Required Settings

The following settings are required in the MVC HTML Helper or Angular component. The WebSocketURL must be specified to route to the separate instance.

Angular

In Angular, you can only define the WebSocketHandler address.

<tx-document-editor width="1000px"
                    height="500px"
                    webSocketURL="wss://your.server.com/">
</tx-document-editor>

In case you are using the Node.js WebSocketHandler, the ServiceAddress must be defined in the settings of the Node.js component:

const { WebSocketServer } = require('@txtextcontrol/tx-websocket-server');
const express = require('express');
const app = express();
const server = app.listen(8080);

var wsServer = new WebSocketServer(server,
{
    serviceAddress: "your.server.com", servicePort: 4277
});

If you are using ASP.NET (Core) as a backend, you will have to create a custom WebSocketMiddleware. This article explains how to build this:

Deploying the Backend TCP Service Separately

ASP.NET MVC

Using the MVC component, the ServiceAddress can be set in the properties of the control. This address is then used by the WebSocketHandler to connect to the required TCP Service.

@Html.TXTextControl().TextControl(settings => {
   settings.ServiceAddress = IPAddress.Parse("192.168.0.222");
}).Render()

Scenario 3: Complete Separation

In this scenario, the document processing is completely decoupled from your web application and deployment strategy. A completely separate instance is independently deployed and maintained. The document editor is connecting directly to the separate instance to synchronize the rendering.

Your web application can be deployed and maintained by using your deployment strategy without any changes.

TX Text Control Deployment Scenario

Pros and Cons

The following table lists the advantages and potential disadvantages of this deployment strategy.

Advantages
Deployment to any server platform
No change to your normal deployment strategy
Completely separated server for document processing
Separate document processing services is reusable by other applications and servers
Easy scaling (load balancing)

Required Settings

The following settings are required in the MVC HTML Helper or Angular component. The WebSocketURL must be specified to route to the separate instance.

Angular

<tx-document-editor width="1000px"
                    height="500px"
                    webSocketURL="wss://your.server.com/">
</tx-document-editor>

ASP.NET MVC

@Html.TXTextControl().TextControl(settings => {
   settings.WebSocketURL = "wss://your.server.com/";
}).Render()

Conclusion

All of the above strategies have their advantages and their right to exist. Consider your deployment strategy carefully based on your requirements. If you are not sure what the best strategy is, contact our engineers to get some help and more insights. We are more than happy to help!

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Angular

Integrate document processing, editing, sharing, collaboration, creation, electronic signatures, and PDF generation into your Angular Web applications.

Learn more about Angular

Related Posts

AngularASP.NETJavaScript

Using the Document Editor in SPA Applications using the removeFromDom Method

This article shows how to use the removeFromDom method to remove the Document Editor from the DOM when it is no longer needed. This is useful when the Document Editor is used in a Single Page…


AngularASP.NETJavaScript

Observe When the Reporting Preview Tab is Active Using MutationObserver

This article shows how to observe when the Reporting Preview tab is active using MutationObserver. The Reporting Preview tab is a feature of the TX Text Control Document Editor that allows you to…


AngularASP.NETJavaScript

Building an ASP.NET Core Backend Application to Host the Document Editor and…

This article explains how to create an ASP.NET Core backend application to host the Document Editor and Document Viewer. This backend application is required to provide the required functionality…


AngularASP.NETJavaScript

Reuse Angular Document Editor Instances in Bootstrap Tabs

The initialization time of document editor instances is time-consuming and requires resources on both the server side and the client side. To reuse instances, they can be moved within the DOM.…


AngularASP.NETJavaScript

JavaScript: Avoid Flickering and Visual Updates by Grouping Undo Steps

The JavaScript API can be used to group several steps into one undo action that can be undone with a single undo call. Additionally, those groups are visually updated at once to avoid screen…