Skip to content

Commit 3ad653c

Browse files
dreyfus92tauri-bot
authored andcommitted
[ci] format
1 parent 9e31562 commit 3ad653c

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

src/content/docs/features/websocket.mdx

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -27,65 +27,66 @@ Install the websocket plugin to get started.
2727
<TabItem label="Automatic" >
2828
Use your project's package manager to add the dependency:
2929

30-
{ ' ' }
31-
32-
<CommandTabs
33-
npm="npm run tauri add websocket"
34-
yarn="yarn run tauri add websocket"
35-
pnpm="pnpm tauri add websocket"
36-
cargo="cargo tauri add websocket"
37-
/>
38-
</TabItem>
39-
40-
<TabItem label = "Manual">
41-
<Steps>
42-
43-
1. Install the websocket plugin by adding the following to your `Cargo.toml` file:
44-
45-
```toml title="src-tauri/Cargo.toml"
46-
[dependencies]
47-
tauri-plugin-websocket = "2.0.0-beta"
48-
# alternatively with Git:
49-
tauri-plugin-websocket = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
50-
```
51-
52-
2. Modify `lib.rs` to initialize the plugin:
53-
54-
```rust title="src-tauri/src/lib.rs" ins={3}
55-
fn run() {
56-
tauri::Builder::default()
57-
.plugin(tauri_plugin_websocket::init())
58-
.run(tauri::generate_context!())
59-
.expect("error while running tauri application");
60-
}
61-
```
62-
63-
3. Install the JavaScript Guest bindings using your preferred JavaScript package manager:
64-
65-
<CommandTabs
66-
npm = "npm install @tauri-apps/plugin-websocket"
67-
yarn = "yarn add @tauri-apps/plugin-websocket"
68-
pnpm = "pnpm add @tauri-apps/plugin-websocket"
69-
/>
70-
71-
</Steps>
72-
</TabItem>
30+
{ ' ' }
31+
32+
<CommandTabs
33+
npm="npm run tauri add websocket"
34+
yarn="yarn run tauri add websocket"
35+
pnpm="pnpm tauri add websocket"
36+
cargo="cargo tauri add websocket"
37+
/>
38+
</TabItem>
39+
40+
<TabItem label = "Manual">
41+
<Steps>
42+
43+
1. Install the websocket plugin by adding the following to your `Cargo.toml` file:
44+
45+
```toml title="src-tauri/Cargo.toml"
46+
[dependencies]
47+
tauri-plugin-websocket = "2.0.0-beta"
48+
# alternatively with Git:
49+
tauri-plugin-websocket = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
50+
```
51+
52+
2. Modify `lib.rs` to initialize the plugin:
53+
54+
```rust title="src-tauri/src/lib.rs" ins={3}
55+
fn run() {
56+
tauri::Builder::default()
57+
.plugin(tauri_plugin_websocket::init())
58+
.run(tauri::generate_context!())
59+
.expect("error while running tauri application");
60+
}
61+
```
62+
63+
3. Install the JavaScript Guest bindings using your preferred JavaScript package manager:
64+
65+
<CommandTabs
66+
npm = "npm install @tauri-apps/plugin-websocket"
67+
yarn = "yarn add @tauri-apps/plugin-websocket"
68+
pnpm = "pnpm add @tauri-apps/plugin-websocket"
69+
/>
70+
71+
</Steps>
72+
</TabItem>
73+
7374
</Tabs>
7475

7576
## Usage
7677

7778
The websocket plugin is available in JavaScript.
7879

7980
```js
80-
import WebSocket from "@tauri-apps/plugin-websocket";
81+
import WebSocket from '@tauri-apps/plugin-websocket';
8182

82-
const ws = await WebSocket.connect("ws://127.0.0.1:8080");
83+
const ws = await WebSocket.connect('ws://127.0.0.1:8080');
8384

8485
ws.addListener((msg) => {
8586
console.log('Received Message:', msg);
8687
});
8788

88-
await ws.send("Hello World!");
89+
await ws.send('Hello World!');
8990

9091
await ws.disconnect();
9192
```
@@ -107,10 +108,9 @@ See [Access Control List](/references/v2/acl) for more information.
107108
```
108109

109110
| Permission | Description |
110-
|---------------------------|---------------------------------------------------------------|
111+
| ------------------------- | ------------------------------------------------------------- |
111112
| `websocket:default` | Allows connecting and sending data to a WebSocket server |
112113
| `websocket:allow-connect` | Enables the connect command without any pre-configured scope. |
113114
| `websocket:deny-connect` | Denies the connect command without any pre-configured scope. |
114115
| `websocket:allow-send` | Enables the send command without any pre-configured scope. |
115116
| `websocket:deny-send` | Denies the send command without any pre-configured scope. |
116-

0 commit comments

Comments
 (0)