Version 1.2

Endpoint Documentation - /Sockets

Below is the documentation for the developed endpoints under the base route /Sockets. This information will be used to generate an HTML that presents the details in a visually appealing manner.

{{ endpoint.name }}

Method: {{ endpoint.method }}

Description: {{ endpoint.description }}

Parameters:

Response:

Usage: {{ endpoint.usage }}

Installation Guide for Angular 18 with ngx-socket-io

This section will guide you through the installation of the ngx-socket-io library in an Angular 18 project. This is essential for integrating real-time communication in your application using WebSockets.

Step 1: Install ngx-socket-io

Run the following command in your Angular project to install ngx-socket-io:

npm install ngx-socket-io

Step 2: Configure the Socket

After installation, you need to configure the SocketIoModule in your Angular application. Below is an example configuration in app.module.ts:


import { ApplicationConfig, importProvidersFrom, provideZoneChangeDetection } from '@angular/core';
import { provideRouter, withViewTransitions } from '@angular/router';

import { routes } from './app.routes';
import { provideHttpClient } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io';

const config: SocketIoConfig = { url: 'http://localhost:3005', options: {} };

export const appConfig: ApplicationConfig = {
  providers: [
    provideZoneChangeDetection({ eventCoalescing: true }),
    provideRouter(routes, withViewTransitions()),
    provideHttpClient(),
    importProvidersFrom(BrowserAnimationsModule, SocketIoModule.forRoot(config))
  ]
};
        

Step 3: Refer to the WebSocket Service

You can refer to the following GitHub file for the complete implementation of the WebSocket service that handles the communication logic.