我在Node JS上的表单有一些问题

时间:2019-02-03 12:02:59

标签: node.js mongoose backend

private SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);

public async Task SendAsync(string message)
{
    if (_ws.State != WebSocketState.Open)
        throw new Exception("Connection is not open");

    try
    {
        await _semaphore.WaitAsync().ConfigureAwait(false);

        var cancel = new CancellationTokenSource(5000);
        var bytes = new ArraySegment<byte>(Encoding.UTF8.GetBytes(message));
        await _ws.SendAsync(bytes, WebSocketMessageType.Text, true, cancel.Token).ConfigureAwait(false);
    }
    finally
    {
        _semaphore.Release();
    }
}

我得到错误:TypeError:无法读取未定义的属性“ lenght” 谁能帮我! 感谢高级。

0 个答案:

没有答案