Comments (9)
The way I worked around the issue on Windows for now, is by setting the global Keep-alive Interval in the registry to something really large.
HKLM:\Software\Microsoft\WebSocket\KeepaliveInterval
It's should be a DWORD, if it does not exist already.
This will affect anything that uses the global setting and does not have it's own setting. (All .NET Core WebSockets currently)
I found this in an msdn page:
WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL
Sets the interval, in milliseconds, to send a keep-alive packet over the connection. The default interval is 30000 (30 seconds). The minimum interval is 15000 (15 seconds). Using WinHttpSetOption to set a value lower than 15000 will return with ERROR_INVALID_PARAMETER.
Note The default value for WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL is read from HKLM:\SOFTWARE\Microsoft\WebSocket\KeepaliveInterval. If a value is not set, the default value of 30000 will be used. It is not possible to have a lower keepalive interval than 15000 milliseconds.
from discord.net.
If this is running on a Linux/OSX box, be sure to add the Discord gateway cert:
certmgr -ssl https://gateway.discord.gg
from discord.net.
Unable to Reproduce;
Copied your project.json, Program.cs
Using Discord.Net 0.9.2 from NuGet.
dotnet 1.0.0-preview1-002702
from discord.net.
I'm using:
- Windows 10 Pro 64bit
- Visual Studio 2015 Community
- 1.0.0-preview1-002702
- Latest version of Discord.net from the master branch on GitHub
I've attached the project with the issue. InactivityIssue.zip
Folder structure:
YourProjectsFolder\Discord.Net\src\Discord.Net
YourProjectsFolder\InactivityIssue\
I get the same issue when I dotnet publish -c Release
and run it on a remote Windows Server 2012.
from discord.net.
Thanks, I was able to reproduce with your project, looking into it.
from discord.net.
This appears to be tied to WebSocketClient's built-in KeepAliveInterval, which runs every 30 seconds of no activity.
I tried disabling it on my end, but if you look at https://github.com/dotnet/corefx/blob/master/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/ClientWebSocketOptions.cs#L131 - I don't see this option being used anywhere.
EDIT: Found an issue for this: https://github.com/dotnet/corefx/issues/5116
from discord.net.
This can be really frustrating issue as bot on low traffic guilds is coming on/off all the time missing commands and events. I've managed to over come this by deploying to docker on Synology NAS (any Linux environment should work), where it works flawlessly.
Since stable release of WebSockets.Client doesn't support unix yet, it's necessary to download latest beta version from https://dotnet.myget.org/feed/dotnet-core/package/nuget/System.Net.WebSockets.Client
Or bump Discord.Net/projects.json dependency to
"System.Net.WebSockets.Client": "4.0.1-beta*",
(this requires adding MyGet into NuGet package sources)
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
from discord.net.
I've talked to Discord about this, and they're going to fix this sometime on their end, adding support for keepalive packets. @jhgg
from discord.net.
This fix is live.
from discord.net.
Related Issues (20)
- ReceivedGatewayEvent HOT 5
- [Bug]: Nested attributes are not passed down to commands
- [Bug]: Can`t delete or modify ephemeral message after Interaction error 10008 Unknown Message HOT 2
- [Bug]: HOT 3
- [Bug]: MessageUpdate not showing old message content when bot is rebooted HOT 7
- [Bug]: AutoModActionExecuted doesnt seem to fire HOT 1
- Add Unknown event
- Request: Easy bypass for Defer 3 Second clock sync issue HOT 5
- [Bug]: CreatePostWithFileAsync Throws Error for Forums that Require Tags
- Spanish translation HOT 3
- [Bug]: ModifyMessageAsync timed out HOT 2
- [Bug]: Doesn't connect using newest WS4NetProvider
- [Bug]: Error converting value {null} to type 'System.DateTimeOffset'. Path 'member.joined_at'. HOT 6
- ConnectAsync time out
- Missing `available` attribute on GuildEmote
- [Bug]: NullReferenceException on interaction creation HOT 2
- There is no API to get user's banner
- There is no API to mute or deaf members HOT 1
- [Bug]: Null reference error in context UserInstall
- Slow auto reconnect causes commands to time out
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord.net.