Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vite-plugin-nitro): enable websocket support & add docs #1419

Open
wants to merge 2 commits into
base: beta
Choose a base branch
from

Conversation

nckirik
Copy link
Contributor

@nckirik nckirik commented Oct 25, 2024

PR Checklist

Closes #1398

What is the new behavior?

  • Enables WebSocket support for development environment
  • Adds WebSocket documentation

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit 30a9a9b
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/671b6c4ad9a0be000828b702
😎 Deploy Preview https://deploy-preview-1419--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 30a9a9b
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/671b6c4a1f5ca200088d6655
😎 Deploy Preview https://deploy-preview-1419--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for analog-ng-app ready!

Name Link
🔨 Latest commit 30a9a9b
🔍 Latest deploy log https://app.netlify.com/sites/analog-ng-app/deploys/671b6c4ad9a0be000828b706
😎 Deploy Preview https://deploy-preview-1419--analog-ng-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nckirik nckirik changed the title Feat Websocket Support feat(vite-plugin-nitro): Websocket Support & Docs Oct 25, 2024
@nckirik nckirik changed the title feat(vite-plugin-nitro): Websocket Support & Docs feat(vite-plugin-nitro): websocket support & docs Oct 25, 2024
Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit 30a9a9b
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/671b6c4ab22476000877dc0c
😎 Deploy Preview https://deploy-preview-1419--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.


## Enable WebSockets

Currently, WebSocket support in [Nitro](https://nitro.unjs.io/guide/websocket) is experimental and it should be enabled:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Currently, WebSocket support in [Nitro](https://nitro.unjs.io/guide/websocket) is experimental and it should be enabled:
Currently, WebSocket support in [Nitro](https://nitro.unjs.io/guide/websocket) is experimental and it can be enabled in the `analog` plugin:


### WebSocket Routes

Due to technical limitations in the Analog-Nitro integration, WebSocket routes are exposed without the `/api` prefix.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Due to technical limitations in the Analog-Nitro integration, WebSocket routes are exposed without the `/api` prefix.
Analog's internal API middleware is not applied to WebSocket routes, therefore, WebSocket routes are exposed without the `/api` prefix.


Due to technical limitations in the Analog-Nitro integration, WebSocket routes are exposed without the `/api` prefix.

For example, `src/server/routes/ws/chat.ts` will be exposed as `ws://example.com/ws/chat` instead of `ws://example.com/api/ws/chat`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, `src/server/routes/ws/chat.ts` will be exposed as `ws://example.com/ws/chat` instead of `ws://example.com/api/ws/chat`
For example, `src/server/routes/ws/chat.ts` is exposed as `ws://example.com/ws/chat` instead of `ws://example.com/api/ws/chat`


Analog also supports `WebSockets` and `Server-Sent Events` through Nitro.

## Enable WebSockets
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Enable WebSockets
## Enabling WebSockets

@brandonroberts brandonroberts changed the title feat(vite-plugin-nitro): websocket support & docs fix(vite-plugin-nitro): enable websocket support & add docs Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Websocket Support
2 participants