Skip to content

Diff is not sent when websocket connects on new request #72

@relistan

Description

@relistan

The lifecycle of the request (intentionally) causes render to happen twice on a new request:

  1. When the HTTP request is made
  2. When the websocket upgrade happens

Our understanding is that the code should be patching the page if it changed between (1) and (2). This does not seem to happen.

According to the comment here: https://github.com/jfyne/live/blob/master/http.go#L404-L406, when the websocket connects, and render is called the second time, the diff should be sent on the websocket. However, that is conditional on LatestRender not being nil here: https://github.com/jfyne/live/blob/master/render.go#L38

From our testing, LatestRender is always nil and so the diff is never sent on the websocket. The render happens on the HTTP socket and is stored to the socket. However, the browser makes a second request with the upgrade header set. It seems that the state of the previous render is lost between these calls.

_serveWS seems to indicate that it should be retrieving the socket from the session: https://github.com/jfyne/live/blob/master/http.go#L323 I don't yet see how it can connect those two renders.

Any insight into what's going on here is appreciated. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions