MT4 Price Socket Server

This server provides real-time price updates for MT4 symbols.

Client Implementation Notes

The server now supports message compression to reduce bandwidth usage. Clients should implement decompression as follows:


// Client-side decompression example (JavaScript)
socket.on('message', function(message) {
  // Check if message is compressed
  if (message && message.compressed === true) {
    try {
      // Decode base64 and decompress
      const compressedData = atob(message.data); // For browser
      // OR: const compressedData = Buffer.from(message.data, 'base64'); // For Node.js
      
      // Decompress (using pako or other zlib-compatible library)
      // Browser: const decompressedStr = pako.inflate(compressedData, { to: 'string' });
      // Node.js: const decompressedStr = zlib.inflateSync(compressedData).toString();
      
      // Parse the JSON
      const decompressedMessage = JSON.parse(decompressedStr);
      
      // Process the decompressed message
      processMessage(decompressedMessage);
    } catch (error) {
      console.error('Error decompressing message:', error);
    }
  } else {
    // Message is not compressed, process normally
    processMessage(message);
  }
});
        

For more information, check the server status.