Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

add WebSocket support #2388

Closed
wants to merge 31 commits into from
Closed

add WebSocket support #2388

wants to merge 31 commits into from

Conversation

krombel
Copy link
Contributor

@krombel krombel commented Jul 26, 2017

This is my working version for websocket support in synapse.

  • The Specification for the protocol can be found here
  • a working riot-web client can be build by using my matrix-js-sdk fork (or my hosted version)
  • to activate the websocket component (and to decide if compression should be used or not) you need to enable "websocket" as ressource
  • discussion can take place in #matrix-websockets:matrix.org

Example config to enable Websocket which shall be reverse-proxied can look like:

 - port: 8008
    tls: false
    bind_address: '127.0.0.1'
    type: http
    x_forwarded: true
    resources:
      - names: [client]
        compress: false
      - names: [websocket]
        compress: true

Signed-off-by: Matthias Kesler krombel@krombel.de

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

2 similar comments
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@MTRNord
Copy link
Contributor

MTRNord commented Sep 2, 2018

Hi any updates planned in the future? /me hopes this would be a better alternative for Android without GCM than doing requests every few minutes.

@krombel
Copy link
Contributor Author

krombel commented Sep 6, 2018

@MTRNord further development is currently stalled. I am using it daily on my server and are rebasing this from time to time.
There are currently tests missing for this part (as I currently don't know how to do them) but else I think, this is following MSC1148

@ara4n
Copy link
Member

ara4n commented Sep 6, 2018

See also matrix-org/matrix-js-sdk#461 for the js-sdk side of this.

I realised that we've only fed back in #riot-dev and #matrix-dev on this, but for the record: the work here looks really good. I'm still unclear on how much of a benefit WS is actually providing (in terms of bandwidth usage or latency) as per matrix-org/matrix-js-sdk#461 (comment), and we haven't had bandwidth to evaluate it ourselves, otherwise we might be in a position to prioritise it higher.

However, we otherwise simply don't have bandwidth in the core team to shepherd it through currently - we are putting all our effort into fixing synapse's core stability problems and getting the spec to a 1.0 (and synapse to a 1.0) rather than adding new features. So either it needs to be clearly a massive improvement, or we need someone else to step in and review it and benchmark it and make the case for prioritising it. Sorry that it's got stuck for so long :(

@richvdh
Copy link
Member

richvdh commented Sep 6, 2018

To add to what matthew said: it's not just about shepherding this into synapse. Even if it did make a big improvement, it's rare that something substantial like this lands and immediately integrates perfectly with other software, so we'd have to budget for some time to handle any issues that might come up. I'm very keen that we don't get distracted into bug-fixing of new features rather than stabilising what we have.

@krombel
Copy link
Contributor Author

krombel commented Sep 6, 2018

Your mentions are valid. I started this websocket project as POC because people were asking for this.
And since then I continued using it on my server - mainly probably because I have developed it.
I opened this PR (and the one in matrix-js-sdk) in the intention to get it merged, but currently I see it as a reference for other people who want to experiment with.
And I am currently updating it from time to time to keep it in a working state.

- fix ref-errors
- handle presence at init to not show the user as offline all
  the time while beeing connected
- now the presence-state will reset to known presence on every method
  which will be used when the user is online - although he has set to
  appear as offline
- do not set the presence on each request but instead "just bump" the
  presence time when a new event (caused by manual interaction) gets
  received
- remove usage of unneeded lambda terms
- rename "content" to "params" to be consistent to other _handle_*()
- throw SynapseError(400) instead of KeyError when more than allowed
  params were passed
- enable websocket-endpoint by using ressource "websocket"
- enable compression based on config
- make use of remote host (or x-forwarded-for) (based on config)
Some debug tools I have found do not allow setting a
WebSocket protocol. To be able to use them evaluate the parameter
and only throw an Exception (which leads to socket termination) when
a not-allowed protocol is passed (currently all beside "m.json")

Default: m.json in case no protocol was specified
@binarymaster
Copy link
Contributor

Any updates? This feature might decrease network traffic consumption, so it will utilize low network bandwidth cases better.

Also:

This branch has conflicts that must be resolved

@richvdh
Copy link
Member

richvdh commented Nov 26, 2021

sadly, given we haven't found time to merge this in 4.5 years, I can't see that situation changing any time soon, so I'm going to go ahead and close it.

@richvdh richvdh closed this Nov 26, 2021
@amytimed
Copy link

amytimed commented Apr 2, 2023

Would like to see this merged

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-blocked (Deprecated Label)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants