Ceisteanna leis an gclib seo á dtaispeáint: Taispeáin gach ceist
  • Cartlannaithe

Firefox can’t establish a websocket connection to the server

Hi, I am working on websocket with javascript and php. Let me share my code here: index.php is: <!DOCTYPE html> <html> <head> <… (tuilleadh eolais)

Hi, I am working on websocket with javascript and php. Let me share my code here:

index.php is:

    <!DOCTYPE html>
    <html>
    <head>
      <title>WebSocket Chat</title>
        <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self' cstechnologyindia.com:8080">

    </head>
    <body>
      <b>WebSocket Chat</b>
      <div id="chatBox"></div>
      <input type="text" id="messageInput" placeholder="Type your message..." />
      <button id="sendButton">Send</button>

      <script>
        const socket = new WebSocket('wss://cstechnologyindia.com/websocket1');

        // Function to save message on the server
        function saveMessage(message) {
          const xhr = new XMLHttpRequest();
          xhr.open('POST', 'save-message.php');
          xhr.setRequestHeader('Content-Type', 'application/json');
          xhr.send(JSON.stringify({ message: message }));
        }

        // Function to fetch messages from the server
        function fetchMessages() {
          const xhr = new XMLHttpRequest();
          xhr.open('GET', 'fetch-messages.php');
          xhr.onreadystatechange = function() {
            if (xhr.readyState === XMLHttpRequest.DONE) {
              if (xhr.status === 200) {
                const messages = JSON.parse(xhr.responseText);
                const chatBox = document.getElementById('chatBox');
                messages.forEach(function(message) {
                  const messageElement = document.createElement('div');
                  messageElement.textContent = message.fname;
                  chatBox.appendChild(messageElement);
                });
              } else {
                console.log('Error fetching messages:', xhr.status);
              }
            }
          };
          xhr.send();
        }

        // Event listener for receiving messages from the server
        socket.addEventListener('message', function(event) {
          const message = event.data;
          const chatBox = document.getElementById('chatBox');
          const messageElement = document.createElement('div');
          messageElement.textContent = message;
          chatBox.appendChild(messageElement);
        });

        const sendButton = document.getElementById('sendButton');
        sendButton.addEventListener('click', function() {
          const messageInput = document.getElementById('messageInput');
          const message = messageInput.value;
          socket.send(message);
          messageInput.value = '';

          // Save the sent message on the server
          saveMessage(message);
        });

        // Fetch messages when the page loads
        fetchMessages();
      </script>
    </body>
    </html>


server.php is:

    <?php
    require 'vendor/autoload.php';

    use Ratchet\MessageComponentInterface;
    use Ratchet\ConnectionInterface;
    use Ratchet\Server\IoServer;
    use Ratchet\Http\HttpServer;
    use Ratchet\WebSocket\WsServer;
    use Symfony\Component\HttpFoundation\Request;

    class Chat implements MessageComponentInterface {
      protected $clients;

      public function __construct() {
        $this->clients = new \SplObjectStorage;
      }

    public function onOpen(ConnectionInterface $conn) {
        $request = $conn->httpRequest;

        // Handle the WebSocket handshake here
        // You can perform any necessary checks or validation before accepting the connection

         // Example: Check if the WebSocket upgrade header is present
        if (!$request->hasHeader('Upgrade') || strtolower($request->getHeader('Upgrade')[0]) !== 'websocket') {
            // Close the connection if the Upgrade header is missing or incorrect
            $conn->close();
            return;
        }
         // Example: Check if the request contains the expected WebSocket version
         if (!$request->hasHeader('Sec-WebSocket-Version') || $request->getHeader('Sec-WebSocket-Version')[0] !== '13') {
            // Close the connection if the WebSocket version is not supported
            $conn->close();
            return;
         }
         // Example: Check other necessary conditions
         // Store the connection
         $this->clients->attach($conn);
       }
      public function onMessage(ConnectionInterface $from, $msg) {
        $message = htmlspecialchars($msg);
        foreach ($this->clients as $client) {
          $client->send($message);
        }
       }
      public function onClose(ConnectionInterface $conn) {
        $this->clients->detach($conn);
      }
      public function onError(ConnectionInterface $conn, \Exception $e) {
        echo "An error has occurred: {$e->getMessage()}\n";
        $conn->close();
      }
     }
     $chat = new Chat;
     $server = IoServer::factory(
      new HttpServer(
        new WsServer($chat)
      ),
      8080
    );
    $server->run();

The websocket is working all the browser except only firefox. It gives error: Firefox can’t establish a connection to the server at wss://cstechnologyindia.com/websocket1.

I am trying to solve it from past 2 days. I'm using a shared hosting. The hosting provider is saying that everything is perfect from our side. Now I'm hopeless. Please solve my problem anyone. Please check added image. Also I've valid https certificate. Please check attached image.

Asked by vinubangs 8 mí ó shin

Last reply by vinubangs 8 mí ó shin

  • Cartlannaithe

Meta Mask

I no longer can use Firefox after years of being an avid user and supporter. I have followed all directions to enable the u2F extension. Have gone as far as reinstalling … (tuilleadh eolais)

I no longer can use Firefox after years of being an avid user and supporter. I have followed all directions to enable the u2F extension. Have gone as far as reinstalling firefox. Are you going to fix the issue? If not I must discontinue which makes me sad.

Asked by Bill 8 mí ó shin

Last reply by Paul 8 mí ó shin

  • Réitithe
  • Cartlannaithe

"The server encountered an error", unable to view activity or file owner information in google drive

I am currently unable to view any file activity or ownership information in Google Drive in a shared folder. I have tried the following troubleshooting steps: Quit an… (tuilleadh eolais)

I am currently unable to view any file activity or ownership information in Google Drive in a shared folder. I have tried the following troubleshooting steps:

  • Quit and reopen firefox
  • Relaunched firefox in safe mode/extensions disabled
  • Cleared cookies
  • Tried in other browsers (works in Librewolf, Brave and Chromium; doesn't work in any Firefox browser (Nightly, beta, standard)

Asked by Zander 9 mí ó shin

Answered by Zander 9 mí ó shin

  • Cartlannaithe

Sign in Sync loop inssue

Reinstalled Firefox after a computer upgrade and now I'm stuck with a disconnected account and a sync loop. I login and it shows login confirmed but I look in the top rig… (tuilleadh eolais)

Reinstalled Firefox after a computer upgrade and now I'm stuck with a disconnected account and a sync loop. I login and it shows login confirmed but I look in the top right corner where you access your account and it shows that it's disconnected. On top of that, I backed up all of my tabs, favorites and passwords but I don't have the ability to import it from the back up. I'm only given the options to import from another browser. Any help in this matter is greatly appreciated.

Asked by SGTDRE 8 mí ó shin

Last reply by SGTDRE 7 mí ó shin

  • Réitithe
  • Cartlannaithe

Automatic dynamic theme to show name of profile in browser header

I use multiple Firefox profiles. I would like an EASY way to see the name of the Firefox profile somewhere on the screen. The attached image shows a theme I created whi… (tuilleadh eolais)

I use multiple Firefox profiles. I would like an EASY way to see the name of the Firefox profile somewhere on the screen. The attached image shows a theme I created which shows the name of the profile on the menu bar. I forgot exactly how I did it, but it involved typing this in a Word document, taking a screenshot and turning it into a jpeg, crop the image, upload it as a theme, then test it. Repeated several times until I got it to work.

I don't need or want fancy graphics here. I just need the name of the Firefox profile to appear somewhere in the window. In my fantasy world, there would be an option to include this name in the window Title bar.

Asked by dan400man1 8 mí ó shin

Answered by Paul 8 mí ó shin

  • Cartlannaithe

UI Text Changes Color (Greys Out) When Firefox Window Loses Focus

After updating to Firefox 115.0-1, I noticed that the tab names for all inactive tabs automatically greys out whenever the main Firefox window loses focus (see attached g… (tuilleadh eolais)

After updating to Firefox 115.0-1, I noticed that the tab names for all inactive tabs automatically greys out whenever the main Firefox window loses focus (see attached gif image). Only the system theme is affected. I should also note that only Firefox 115 exhibits this behavior (downgrading to Firefox 114.0.2-1 fixes the issue).

I'm not sure if this is by design. I've gone through the change log for Firefox 115 and found no mentions of this.

Of course, the behavior isn't that big of a deal. However, since I'm using a window manager (i3wm), an annoying "flash" (see attached gif image) can be observed every time I press a keybinding to activate a binding mode.

If this is a new feature, I'd very much like to turn it off in about:config.

Does anyone know how?

Asked by Anthony 8 mí ó shin

Last reply by Anthony 8 mí ó shin

  • Réitithe
  • Cartlannaithe

Text glitching only in Firefox

I've been having a weird issue with my text glitching only in my Firefox browser. Initially I thought it might be my monitor but then I realized the issue only presents i… (tuilleadh eolais)

I've been having a weird issue with my text glitching only in my Firefox browser. Initially I thought it might be my monitor but then I realized the issue only presents itself in my Firefox browser. Literally no other program is affected.

I've done a reset, I've uninstalled and done a clean install, I've deleted all Firefox files and re-downloaded the browser. The issue immediately pops up again.

Asked by janna.g.landry 8 mí ó shin

Answered by janna.g.landry 7 mí ó shin

  • Cartlannaithe

Firefox not opening the Roblox link properly

So I have the latest version of macOS Ventura, the latest version of Firefox, and the latest version of Roblox. Whenever I try to open a Roblox game from their website (y… (tuilleadh eolais)

So I have the latest version of macOS Ventura, the latest version of Firefox, and the latest version of Roblox. Whenever I try to open a Roblox game from their website (yes, I know. Roblox now has the desktop app so you don't need the website to open a game), it opens the app, but not the link, which means it doesn't open the game :( Does anybody know how to get Firefox to open the link and not just the app? (Btw no hate on firefox)

Asked by thisiscoolio 8 mí ó shin

Last reply by Greymagic27 8 mí ó shin

  • Cartlannaithe

Setting Printer Potrait or Landscape

Good afternoon, hi admin, regarding the latest update, please for the printer settings for landscape and portrait to be displayed on the right as before and permanently f… (tuilleadh eolais)

Good afternoon, hi admin, regarding the latest update, please for the printer settings for landscape and portrait to be displayed on the right as before and permanently for the choice of portrait and landscape settings. because we are constrained by the print settings for PDF, we have to go to the printer settings all the time. please help for the next update. thank you for your concern.

Asked by purchase.job22 8 mí ó shin

Last reply by jscher2000 - Support Volunteer 3 mhí ó shin

  • Cartlannaithe

outlook dot com error when signing in

I get this error when trying to access my email using FireFox. Lately this (or a similar) error happens weekly if not every couple of days. Always first thing in the morn… (tuilleadh eolais)

I get this error when trying to access my email using FireFox. Lately this (or a similar) error happens weekly if not every couple of days. Always first thing in the morning, too.

UTC Date: 2023-07-16T15:17:20.490Z

Client Id: 57C5EE00898E486392D56E4C2F706F9E

Session Id: 84e33266-6f14-4c67-bcf7-f5589a5e04c5

Client Version: 20230707009.10

BootResult: network

Back Filled Errors: Unhandled Rejection: Error: NetworkResponseError:undefined|undefined:undefined

err: Error: NetworkResponseError

esrc: StartupData

et: ServerError

estack: K@https://res-h3.public.cdn.office.net/owamail/20230707009.10/scripts/owa.mailindex.js:2:260625

p/<@https://res-h3.public.cdn.office.net/owamail/20230707009.10/scripts/owa.mailindex.js:2:259787

my email works just fine using Safari so I am at a loss.

I have tried running FF (Firefox) in safe mode, ensuring outlook.live.com is an exception to the pop up window blocker, changed default protections on outlook dot com to none from standard.... Turned off ABP, clearing cache and cookies from within FF.

it may be worth mentioning that I can still browse/access other websites while outlook produces this error, and my network settings within FF are set to use default system settings (no proxy).

Asked by billy_hill_65 7 mí ó shin

Last reply by jonzn4SUSE 7 mí ó shin

  • Cartlannaithe

Copy/Paste not working

The people who asked this question 3 years ago were given a "chosen solution", which didn't work then. And 3 years later the underlying problem is still not fixed. Last w… (tuilleadh eolais)

The people who asked this question 3 years ago were given a "chosen solution", which didn't work then. And 3 years later the underlying problem is still not fixed. Last week I tried a new solution which meant messing around with the Firefox settings. And it worked - until the next time I restarted the computer.

I copy and paste in many of my activities, which interact with external websites e.g. discussion groups. The current frustration is a discussion about Adobe, which means copying text from one window to another. It does not happen. Unless this is permanently sorted in the next couple of days, regretfully I shall switch to a workable browser, e.g. Chrome. I cannot afford the waste of time repeatedly researching then not fixing a failing feature.

Asked by cvhorie 8 mí ó shin

Last reply by jscher2000 - Support Volunteer 7 mí ó shin

  • Cartlannaithe

How to open links to filesystem folders with system file manager.

I have a 'site' that is just files on my hard drive. I need to click an anchor link such as: <a href="file:///dir1/dir2/dir3/dir4">Store Your Files Here</a> … (tuilleadh eolais)

I have a 'site' that is just files on my hard drive.

I need to click an anchor link such as: <a href="file:///dir1/dir2/dir3/dir4">Store Your Files Here</a> and have Firefox open the folder dir4 with the systems file manager. ( In my case the file manager is Nautilus ) ( Ubuntu 20.04 )

I have seen this: http://kb.mozillazine.org/Links_to_local_pages_do_not_work but it does not describe a scenario that uses the file:/// interface.

It also does not provide any information about how the files will be handled.

I can get the folder link to work currently , but it appears with the: 'Index of file///...' in a browser tab.

Obviously you can not use that for anything useful.

The main goal is to open the folder and be able to use the system file manager to include more content for the site without having to navigate to the folder manually. The folders I want to display are buried many levels down without the possibility of having descriptive names. I have ~121 pages/folders in this arrangement , and each one has content for each page. I would like to add a button on each of the 121 pages that will open each of the pages content folder.

Asked by Tyranna 8 mí ó shin

Last reply by cor-el 7 mí ó shin

  • Cartlannaithe

How do I remove alternative languages from Firefox Language Settings?

I set my browser to use English instead of my local language and I expect sites to use English by default. Now for some reason Gmail showed me a "do you want to leave thi… (tuilleadh eolais)

I set my browser to use English instead of my local language and I expect sites to use English by default. Now for some reason Gmail showed me a "do you want to leave this page" browser dialogue in language other than English.

Turns out, there's a new(?) option to set alternative interface languages, and I suppose websites can now choose which one to use?

Wow, just noticed, even tooltips on this website aren't in English anymore. This is extremely annoying.

I'd love to remove the alternate language from that list and leave Firefox interface exclusively in English. There is no option to remove the second language, only to move priority (see screenshot).

Searching through about:config with "language" didn't help. The closest relevant result was for the dictionaries. I do not have problems with dictionaries; "alternate" did not bring any relevant results either.

Asked by Fly McFlyson 8 mí ó shin

Last reply by cor-el 8 mí ó shin

  • Cartlannaithe

Font size too small on menu bar and bookmarks toolbar

I have just completed a new computer with new Windows 11 and fresh dowhload of Firefox and was very dissappointed to find that the Firefox font sizes on the menu and tool… (tuilleadh eolais)

I have just completed a new computer with new Windows 11 and fresh dowhload of Firefox and was very dissappointed to find that the Firefox font sizes on the menu and toolbars were very difficult to read because of their small size. Most of the available settings in Windows and firefox to increase the font size resulted in making the web pages and fonts bigger as well. Looking through the the Firefox help pages this seems to be a common problem that lacks a satisfactory solution - untill now.

I solved the problem by going into about:config and making the following changes: 1. Make sure that Browser.Display.OS-zoom-behaviour is set to 1 2. Set Layout.css.devPixelsperPx to 1.3 ( or between 1.1 to 1.5 to suit) 3. Set ui.textScaleFactor to 75 ( or between 75 to 100 to suit, decrease this number as you increase previous)

This solved the problem for me and I'm posting in the hope others may find this usefull.

Asked by Ants100 8 mí ó shin

Last reply by cor-el 8 mí ó shin

  • Cartlannaithe

Microsoft Defender Antivirus found Trojan:Script/Wacatac.B!ml in langpack-en-US@firefox.Mozilla.org.xpi

I recently had Firefox auto update the version of Firefox on my windows computer I have for personal use. Within 48 hours or so, Microsoft defender gave me the following… (tuilleadh eolais)

I recently had Firefox auto update the version of Firefox on my windows computer I have for personal use. Within 48 hours or so, Microsoft defender gave me the following notification in the image below, also mentioned in the title.

A little research has had mixed results on Reddit. Anyway, I am not directly looking for advice here on securing my device. Rather, I am wondering if there is any chance this could be a problem on the Firefox end, perhaps an issued caused by the recent update? Thanks.

Asked by everestpaintballer 8 mí ó shin

Last reply by everestpaintballer 8 mí ó shin

  • Cartlannaithe

restore bookmarks/profile

My computer 'guru' reinstalled Win10 in order to correct a serious problem. ALL of my programs were gone and I was left with a raw Win10. 6/12/2023 was last date prior to… (tuilleadh eolais)

My computer 'guru' reinstalled Win10 in order to correct a serious problem. ALL of my programs were gone and I was left with a raw Win10. 6/12/2023 was last date prior to the disaster. I reinstalled Firefox. Using the "firefox.exe -p" I can only find the default profile. I DO HAVE a full backup done using the Win7 Backup and Restore feature. How do I resurrect my most recent profile? I will need to find the files(s) manually from the b/u. When I did a Full Restore the bookmarks didn't appear. Where and what files am I looking for? The attached screen shots from the b/u may be of help. [removed email from public forum]

Asked by newspr0 8 mí ó shin

Last reply by cor-el 8 mí ó shin

  • Réitithe
  • Cartlannaithe

Cookies pop-up disappears before I can make a selection.

On a new website or after clearing the cache and cookies and upon opening a page I will often get a pop-up with cookie usage choices, e.g. "strictly necessary", etc. How… (tuilleadh eolais)

On a new website or after clearing the cache and cookies and upon opening a page I will often get a pop-up with cookie usage choices, e.g. "strictly necessary", etc. However, the pop-up disappears before I have a chance to click on any choice or even finish reading the first line. I'm not sure what settings I need to change to allow me to make a choice on the pop-up. Please advise. Thanks.

Asked by BigO 8 mí ó shin

Answered by cor-el 8 mí ó shin