HOME FORUMS MEMBERS RECENT POSTS LOG IN  
× Авторизация
Имя пользователя:
Пароль:
Нет аккаунта? Регистрация
Баннер 1   Баннер 2
НОВЫЕ ТОРГОВАЯ НОВОСТИ ЧАТ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > Общие вопросы программирования
   
 
 
Опции темы Поиск в этой теме Опции просмотра

  #1  
Старый 17.03.2024, 23:40
delanov
Познающий
Регистрация: 11.05.2023
Сообщений: 53
С нами: 1585608

Репутация: 23
По умолчанию

Отправляю аудиопоток на сервер, когда уже доходит выбивает ошибка ниже. Если нужен код по С++ клиенту -- напишите

Цитата:
Сообщение от Спойлер  


JavaScript:





Код:
const
WebSocket
=
require
(
'ws'
)
;
const
fs
=
require
(
'fs'
)
;
const
wss
=
new
WebSocket.Server
(
{
port
:
8080
}
)
;
wss
.
on
(
'connection'
,
function
connection
(
ws
)
{
console
.
log
(
'Client connected'
)
;
ws
.
on
(
'message'
,
function
incoming
(
data
)
{
try
{
fs
.
writeFile
(
'audio_received.wav'
,
data
,
function
(
err
)
{
if
(
err
)
{
console
.
error
(
'Error saving audio file:'
,
err
)
;
}
else
{
console
.
log
(
'Audio file saved successfully'
)
;
}
}
)
;
bina
}
catch
(
error
)
{
console
.
log
(
error
)
;
}
}
)
;
ws
.
on
(
'close'
,
function
close
(
)
{
console
.
log
(
'Client disconnected'
)
;
}
)
;
}
)
;


Цитата:
Сообщение от Спойлер  

Error: Invalid WebSocket frame: invalid UTF-8 sequence

at Receiver.dataMessage (C:\Users\Vladislav\Desktop\nodeJs\node_modules\ws \lib\receiver.js:590:28)

at Receiver.getData (C:\Users\Vladislav\Desktop\nodeJs\node_modules\ws \lib\receiver.js:500:10)

at Receiver.startLoop (C:\Users\Vladislav\Desktop\nodeJs\node_modules\ws \lib\receiver.js:171:16)

at Receiver._write (C:\Users\Vladislav\Desktop\nodeJs\node_modules\ws \lib\receiver.js:98:10)

at writeOrBuffer (node:internal/streams/writable:447:12)

at _write (node:internal/streams/writable:389:10)

at Writable.write (node:internal/streams/writable:393:10)

at Socket.socketOnData (C:\Users\Vladislav\Desktop\nodeJs\node_modules\ws \lib\websocket.js:1303:35)

at Socket.emit (node:events:514:28)

at addChunk (node:internal/streams/readable:376:12)

Emitted 'error' event on WebSocket instance at:

at Receiver.receiverOnError (C:\Users\Vladislav\Desktop\nodeJs\node_modules\ws \lib\websocket.js:1189:13)

at Receiver.emit (node:events:514:28)

at emitErrorNT (node:internal/streams/destroy:151:8)

at emitErrorCloseNT (node:internal/streams/destroy:116:3)

at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {

code: 'WS_ERR_INVALID_UTF8',

[Symbol(status-code)]: 1007

}
 
Ответить с цитированием
 





Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT ™ © 2001- Antichat Kft.