kataras / go-websocket

:speaker: Deprecated. Use https://github.com/kataras/neffos instead
MIT License
60 stars 16 forks source link

how to set up web socket native message size to large size, #8

Closed atjoneswang closed 7 years ago

atjoneswang commented 7 years ago

hi, Can setup messages size to large size, i want use protobuf send image file?

ghost commented 7 years ago

Hi, Websocket accepts configuration fields

    // WriteTimeout time allowed to write a message to the connection.
    // Default value is 15 * time.Second
    WriteTimeout time.Duration
    // PongTimeout allowed to read the next pong message from the connection
    // Default value is 60 * time.Second
    PongTimeout time.Duration
    // PingPeriod send ping messages to the connection with this period. Must be less than PongTimeout
    // Default value is (PongTimeout * 9) / 10
    PingPeriod time.Duration
    // MaxMessageSize max message size allowed from connection
    // Default value is 1024
    MaxMessageSize int64
    // BinaryMessages set it to true in order to denotes binary data messages instead of utf-8 text
    // compatible if you wanna use the Connection's EmitMessage to send a custom binary data to the client, like a native server-client communication.
    // defaults to false
    BinaryMessages bool
    // ReadBufferSize is the buffer size for the underline reader
    ReadBufferSize int
    // WriteBufferSize is the buffer size for the underline writer
    WriteBufferSize int

So, try to increase the MaxMessageSize

Thanks, kataras