# Creating a WebSocket Server Project with Node.js

> The @txtextcontrol/tx-websocket-server npm package enables Node.js to host the backend for TX Text Control document editors. This tutorial covers installing Express and the package, creating the app.js entry point with server configuration, and connecting it to an Angular editor.

- **Author:** Bjoern Meyer
- **Published:** 2020-01-01
- **Modified:** 2026-03-05
- **Description:** The @txtextcontrol/tx-websocket-server npm package enables Node.js to host the backend for TX Text Control document editors. This tutorial covers installing Express and the package, creating the app.js entry point with server configuration, and connecting it to an Angular editor.
- **1 min read** (180 words)
- **Tags:**
  - Angular
  - ASP.NET
  - Node.js
  - Tutorial
- **Web URL:** https://www.textcontrol.com/blog/2020/01/01/creating-a-websocket-server-project-with-nodejs/
- **LLMs URL:** https://www.textcontrol.com/blog/2020/01/01/creating-a-websocket-server-project-with-nodejs/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2020/01/01/creating-a-websocket-server-project-with-nodejs/llms-full.txt

---

This tutorial uses Visual Studio Code that can be [downloaded](https://code.visualstudio.com/) for free.

### Creating the WebSocket Server Project

1. Open a *Node.js command prompt*, create an empty folder called "websocket-server", navigate into and type in the following command to install [Express](https://www.npmjs.com/package/express), the minimalist web framework for node:
    
    ```
    npm i express
    ```
2. Now, install the WebSocket Server package of TX Text Control:
    
    ```
    npm i @txtextcontrol/tx-websocket-server
    ```
3. Open this folder in Visual Studio Code by typing in the following command:
    
    ```
    code .
    ```
4. In Visual Studio Code, create a new file named *app.js* in the project's root folder:
    
    Copy the following code into this JavaScript file and save it:
    
    ```
    const { WebSocketServer } = require('@txtextcontrol/tx-websocket-server');
    const express = require('express');
    const app = express();
    const server = app.listen(8080);
    
    var wsServer = new WebSocketServer(server);
    ```
5. Back in the command prompt, start the Node.js application by typing in the following command:
    
    ```
    node app.js
    ```

### Connecting the Angular Application

When connecting an Angular based document editor application with this Node.js *WebSocket Server*, add this endpoint to the *webSocketURL* parameter:

```
<tx-document-editor
  width="1000px"
  height="500px"
  webSocketURL="ws://localhost:8080/TXWebSocket">
</tx-document-editor>
```

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [Creating an Angular Document Editor Application with a Node.js WebSocket Server](https://www.textcontrol.com/blog/2023/08/24/creating-an-angular-document-editor-application-with-a-nodejs-websocket-server/llms.txt)
- [Integrate Document Editing into any HTML Client using the HTML Widget](https://www.textcontrol.com/blog/2020/01/01/integrate-document-editing/llms.txt)
- [Creating an Angular Document Editor Application](https://www.textcontrol.com/blog/2020/01/01/creating-an-angular-document-editor-application/llms.txt)
- [Text Control Roadmap 2019: High DPI Support, Forms, Node.js and Angular](https://www.textcontrol.com/blog/2019/03/12/text-control-roadmap-2019/llms.txt)
- [Building an ASP.NET Core Backend (Linux and Windows) for the Document Editor and Viewer](https://www.textcontrol.com/blog/2025/03/26/building-an-asp-net-core-backend-for-the-document-editor-and-viewer/llms.txt)
- [Impressions from .NET Developer Conference DDC 2024](https://www.textcontrol.com/blog/2024/11/28/impressions-from-net-developer-conference-ddc-2024/llms.txt)
- [Back from Florida: Impressions from VSLive! Orlando 2024](https://www.textcontrol.com/blog/2024/11/21/back-from-florida-impressions-from-vslive-orlando-2024/llms.txt)
- [Implementing a Security Middleware for Angular Document Editor Applications in C#](https://www.textcontrol.com/blog/2024/10/14/implementing-a-security-middleware-for-angular-document-editor-applications/llms.txt)
- [Meet Text Control at DDC .NET Developer Conference 2024](https://www.textcontrol.com/blog/2024/10/07/meet-text-control-at-ddc-net-developer-conference-2024/llms.txt)
- [Visit Text Control at VSLive! in Orlando, Florida](https://www.textcontrol.com/blog/2024/10/01/visit-tx-text-control-at-vslive-in-orlando-florida/llms.txt)
- [Creating Advanced Tables in PDF and DOCX Documents with C#](https://www.textcontrol.com/blog/2024/09/30/creating-advanced-tables-in-pdf-and-docx-documents-with-csharp/llms.txt)
- [Back in the Pocono Mountains: Meet Text Control at TechBash 2024](https://www.textcontrol.com/blog/2024/09/24/back-in-the-pocono-mountains-meet-text-control-at-techbash-2024/llms.txt)
- [Back from Copenhagen Developers Festival 2024](https://www.textcontrol.com/blog/2024/09/05/back-from-copenhagen-developers-festival-2024/llms.txt)
- [Using the Document Editor in SPA Applications using the removeFromDom Method](https://www.textcontrol.com/blog/2024/09/02/using-the-document-editor-in-spa-applications-using-the-removefromdom-method/llms.txt)
- [Video Tutorial: Creating a MailMerge Template and JSON Data Structure](https://www.textcontrol.com/blog/2024/08/16/video-tutorial-creating-a-mailmerge-template-and-json-data-structure/llms.txt)
- [Observe When the Reporting Preview Tab is Active Using MutationObserver](https://www.textcontrol.com/blog/2024/07/23/observe-when-the-reporting-preview-tab-is-active-using-mutationobserver/llms.txt)
- [Mail Merge: The Pre-Shaped Data Concept Explained](https://www.textcontrol.com/blog/2024/05/30/mail-merge-the-pre-shaped-data-concept-explained/llms.txt)
- [Meet Text Control at NDC Oslo 2024](https://www.textcontrol.com/blog/2024/05/28/meet-text-control-at-ndc-oslo-2024/llms.txt)
- [Form Field Compatibility: Work with AcroForms, Legacy MS Word Forms, and Content Controls](https://www.textcontrol.com/blog/2024/04/04/form-fields-working-with-acroforms-legacy-ms-word-forms-and-content-controls/llms.txt)
- [Comments JavaScript API: Useful Tips and Tricks](https://www.textcontrol.com/blog/2024/04/01/comments-javascript-api-useful-tips-and-tricks/llms.txt)
- [Integrating Document Lifecycle Management with ASP.NET Core and C#](https://www.textcontrol.com/blog/2024/03/29/integrating-document-lifecycle-management-with-asp-net-core-and-c-sharp/llms.txt)
- [Building an ASP.NET Core Backend Application to Host the Document Editor and Document Viewer](https://www.textcontrol.com/blog/2024/03/14/building-an-asp-net-core-backend-application-to-host-the-document-editor-and-document-viewer/llms.txt)
- [Customizing Electronic Signature Fonts for Typed Signatures in Angular and ASP.NET Core](https://www.textcontrol.com/blog/2024/03/11/customizing-electronic-signature-fonts-for-typed-signatures-in-angular-and-asp-net-core/llms.txt)
- [View and Edit MS Word DOCX Documents in Angular](https://www.textcontrol.com/blog/2023/10/26/view-and-edit-ms-word-docx-documents-in-angular/llms.txt)
- [How to Mail Merge MS Word DOCX Documents in ASP.NET Core C#](https://www.textcontrol.com/blog/2023/10/16/how-to-mail-merge-ms-word-docx-documents-in-aspnet-core-csharp/llms.txt)
