Skip to content

Commit 8c94af5

Browse files
Change WebSocket send method to use FastOneByteString
1 parent 6ccdfbc commit 8c94af5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎src/WebSocketWrapper.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,10 @@ struct WebSocketWrapper {
326326
* re-invokes the slow path which throws the proper exception. */
327327

328328
template <bool SSL>
329-
static uint32_t uWS_WebSocket_send_fast(v8::Local<v8::Object> receiver, const v8::FastApiTypedArray<uint8_t>& message, bool isBinary, bool compress, v8::FastApiCallbackOptions& options) {
329+
static uint32_t uWS_WebSocket_send_fast(v8::Local<v8::Object> receiver, const v8::FastOneByteString& message, bool isBinary, bool compress, v8::FastApiCallbackOptions& options) {
330330
auto *ws = (uWS::WebSocket<SSL, true, PerSocketData> *) receiver->GetAlignedPointerFromInternalField(0);
331331
if (!ws) { options.fallback = true; return 0; }
332-
uint8_t *data = nullptr;
333-
if (!message.getStorageIfAligned(&data)) { options.fallback = true; return 0; }
334-
return ws->send(std::string_view((char *) data, message.length()),
332+
return ws->send(std::string_view((char *) message.data, message.length),
335333
isBinary ? uWS::OpCode::BINARY : uWS::OpCode::TEXT, compress);
336334
}
337335

0 commit comments

Comments
 (0)