Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 11 - 20 of 73 for WS (0.01 seconds)

  1. docs_src/websockets/tutorial001_py39.py

                <input type="text" id="messageText" autocomplete="off"/>
                <button>Send</button>
            </form>
            <ul id='messages'>
            </ul>
            <script>
                var ws = new WebSocket("ws://localhost:8000/ws");
                ws.onmessage = function(event) {
                    var messages = document.getElementById('messages')
                    var message = document.createElement('li')
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 1.4K bytes
    - Click Count (0)
  2. tests/test_tutorial/test_websockets/test_tutorial003.py

        response = client.get("/")
        assert response.text == html
    
    
    def test_websocket_handle_disconnection(client: TestClient):
        with (
            client.websocket_connect("/ws/1234") as connection,
            client.websocket_connect("/ws/5678") as connection_two,
        ):
            connection.send_text("Hello from 1234")
            data1 = connection.receive_text()
            assert data1 == "You wrote: Hello from 1234"
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 21:25:59 GMT 2025
    - 1.3K bytes
    - Click Count (0)
  3. internal/grid/grid.go

    package grid
    
    import (
    	"context"
    	"crypto/tls"
    	"errors"
    	"fmt"
    	"io"
    	"net"
    	"net/http"
    	"strconv"
    	"strings"
    	"time"
    
    	"github.com/gobwas/ws"
    	"github.com/gobwas/ws/wsutil"
    	"github.com/minio/minio/internal/bpool"
    )
    
    // ErrDisconnected is returned when the connection to the remote has been lost during the call.
    var ErrDisconnected = RemoteErr("remote disconnected")
    
    Created: Sun Dec 28 19:28:13 GMT 2025
    - Last Modified: Sun Mar 30 00:56:02 GMT 2025
    - 7K bytes
    - Click Count (0)
  4. tests/test_tutorial/test_websockets/test_tutorial002.py

            with client.websocket_connect("/items/foo/ws"):
                pytest.fail(
                    "did not raise WebSocketDisconnect on __enter__"
                )  # pragma: no cover
    
    
    def test_websocket_invalid_data(app: FastAPI):
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws?q=bar&token=some-token"):
                pytest.fail(
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 4.1K bytes
    - Click Count (0)
  5. internal/grid/connection.go

    type wsWriter struct {
    	tmp [ws.MaxHeaderSize]byte
    }
    
    // writeMessage writes a message to w without allocations.
    func (ww *wsWriter) writeMessage(w io.Writer, s ws.State, op ws.OpCode, p []byte) error {
    	const fin = true
    	var frame ws.Frame
    	if s.ClientSide() {
    		// We do not need to copy the payload, since we own it.
    		payload := p
    
    		frame = ws.NewFrame(op, fin, payload)
    Created: Sun Dec 28 19:28:13 GMT 2025
    - Last Modified: Fri Aug 29 02:39:48 GMT 2025
    - 46.9K bytes
    - Click Count (0)
  6. tests/test_http_connection_injection.py

        return conn.app.state.value
    
    
    @app.get("/http")
    async def get_value_by_http(value: int = Depends(extract_value_from_http_connection)):
        return value
    
    
    @app.websocket("/ws")
    async def get_value_by_ws(
        websocket: WebSocket, value: int = Depends(extract_value_from_http_connection)
    ):
        await websocket.accept()
        await websocket.send_json(value)
        await websocket.close()
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sun Aug 09 13:56:41 GMT 2020
    - 972 bytes
    - Click Count (0)
  7. okhttp/src/jvmTest/kotlin/okhttp3/internal/ws/WebSocketWriterTest.kt

     */
    package okhttp3.internal.ws
    
    import assertk.assertThat
    import assertk.assertions.isEqualTo
    import java.util.Random
    import kotlin.test.assertFailsWith
    import okhttp3.TestUtil.repeat
    import okhttp3.internal.format
    import okhttp3.internal.ws.WebSocketProtocol.OPCODE_BINARY
    import okhttp3.internal.ws.WebSocketProtocol.OPCODE_TEXT
    import okhttp3.internal.ws.WebSocketProtocol.PAYLOAD_BYTE_MAX
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Fri Dec 27 13:39:56 GMT 2024
    - 9.3K bytes
    - Click Count (0)
  8. docs_src/app_testing/tutorial002_py39.py

    from fastapi.testclient import TestClient
    from fastapi.websockets import WebSocket
    
    app = FastAPI()
    
    
    @app.get("/")
    async def read_main():
        return {"msg": "Hello World"}
    
    
    @app.websocket("/ws")
    async def websocket(websocket: WebSocket):
        await websocket.accept()
        await websocket.send_json({"msg": "Hello WebSocket"})
        await websocket.close()
    
    
    def test_read_main():
        client = TestClient(app)
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 757 bytes
    - Click Count (0)
  9. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/ws/RealWebSocket.kt

    import okhttp3.internal.connection.asBufferedSocket
    import okhttp3.internal.okHttpName
    import okhttp3.internal.ws.WebSocketProtocol.CLOSE_CLIENT_GOING_AWAY
    import okhttp3.internal.ws.WebSocketProtocol.CLOSE_MESSAGE_MAX
    import okhttp3.internal.ws.WebSocketProtocol.OPCODE_BINARY
    import okhttp3.internal.ws.WebSocketProtocol.OPCODE_TEXT
    import okhttp3.internal.ws.WebSocketProtocol.validateCloseCode
    import okio.BufferedSink
    import okio.BufferedSource
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Thu Jul 31 04:18:40 GMT 2025
    - 21.6K bytes
    - Click Count (0)
  10. tests/test_ws_router.py

        client = TestClient(app)
        with client.websocket_connect("/router-ws-depends/") as websocket:
            assert websocket.receive_text() == "Socket Dependency"
    
    
    def test_router_ws_depends_with_override():
        client = TestClient(app)
        app.dependency_overrides[ws_dependency] = lambda: "Override"  # noqa: E731
        with client.websocket_connect("/router-ws-depends/") as websocket:
            assert websocket.receive_text() == "Override"
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 7.5K bytes
    - Click Count (0)
Back to Top