Skip to content

Commit fb05cc7

Browse files
Fix send_fast_buffer to use correct opcode
1 parent e3ff2c4 commit fb05cc7

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎src/WebSocketWrapper.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,16 @@ template <bool SSL>
341341
static uint32_t uWS_WebSocket_send_fast_buffer(v8::Local<v8::Object> receiver,
342342
v8::Local<v8::Value> message,
343343
bool isBinary, bool compress) {
344+
printf("Hitting fast buffer path\n");
344345
auto *ws = (uWS::WebSocket<SSL, true, PerSocketData> *) receiver->GetAlignedPointerFromInternalField(0);
345346
if (!ws || !message->IsArrayBufferView()) return 0;
346347

347348
auto array = message.As<v8::ArrayBufferView>();
348349
auto contents = array->Buffer()->GetBackingStore();
349350
char* data = static_cast<char*>(contents->Data()) + array->ByteOffset();
350-
351-
printf("Hitting fast buffer path\n");
352351

353352
return ws->send(std::string_view(data, array->ByteLength()),
354-
uWS::OpCode::BINARY, compress);
353+
isBinary ? uWS::OpCode::BINARY : uWS::OpCode::TEXT, compress);
355354
}
356355

357356
template <bool SSL>

0 commit comments

Comments
 (0)