Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7644187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:37:27+00:00 2026-05-31T09:37:27+00:00

I wrote a (not-so-)simple websocket server in python, which listens in a port, performs

  • 0

I wrote a (not-so-)simple websocket server in python, which listens in a port, performs the handshaking and then sends to the client a sequence of messages (spaced out a random interval), containing numbers.

I wrote a javascript client and tested it under Chrome and Safari. I discovered that Chrome and Safari use different WebSocket versions. For example, Chrome uses Sec-WebSocket-Key (and expects Sec-WebSocket-Accept), while Safari sends instead Sec-WebSocket-Key1, Sec-WebSocket-Key2 and a bunch of 8 bytes after the header.

I implemented in the server a handshake function which detects the kind of handshake required, and performs it. This issue is solved. The websocket is correctly open from Chrome or Safari (both OSX, Windows and IOS5 versions).

But I have another problem. Apparently, Safari sends and expects messages delimited by 0x00 and 0xFF, while Chrome sends and expects framed and masked data (using a more recent version of the websocket specification).

I want to have a single server, which adapts himself to the expectations of the client. My question is, how can I tell in advance if the data has to be sent framed or 0x00,0xFF delimited?

I guess I could assume that, if the handshake protocol is based in Key1 and Key2, the client is Safari, and then use 0x00 0xFF to delimit data, while if it uses Sec-WebSocket-Key the client is Chrome, and then use framed data. However I’m not satisfied with this solution, since it is not general. Ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:37:29+00:00Added an answer on May 31, 2026 at 9:37 am

    There are published standards for both the hixie-76 protocol variant used by Safari (desktop & mobile) and RFC 6455 used by Chrome and others.

    You can use the type of handshake requested to decide which protocol version a client speaks, what framing will exist on message reads and what framing you should use on message writes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote two simple programs server and a client using sockets in C++ (Linux).
I wrote a simple VS2010 WPF application which targeted .NET Framework 4 Client Profile
i wrote this simple programme which did not pass the compiling phase using vs2008
I wrote not so simple app, and decided to make applet. I have the
I wrote this simple linq-to-xml query and it seems that null exception could not
I wrote a simple webapp using google app engine in python that allows users
I wrote a simple program that using Class::ArrayObjects but It did not work as
I wrote a simple file parser and writer, but then I came across an
I wrote a simple web service in C# using SharpDevelop (which I just got
I wrote this - very simple - function, and then wondered does VB have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.