Comments (5)
Hey @kinetiq
Do you have a code example anywhere I could try? Are you running through a proxy?
Thanks
from slackconnector.
No proxy, just running this in a simple setup at home.
Code is very simple:
var connector = new SlackConnector.SlackConnector();
Connection = await connector.Connect(slackKey);
Connection.OnMessageReceived += MessageReceived;
Connection.OnDisconnect += OnDisconnect;
Also! If I go into your code and change this line to synchronous, everything works:
IRestResponse response = client.ExecuteAsPost(request, "post");
...The handshake succeeds, and I end up getting events and so on! Any idea what this might be?
from slackconnector.
Is your console app method async? I have seen these kind of issues before when trying to await something when not in an async context.
Could you do something like:
var connector = new SlackConnector.SlackConnector();
Connection = connector.Connect(slackKey).Result;
Connection.OnMessageReceived += MessageReceived;
Connection.OnDisconnect += OnDisconnect;
from slackconnector.
You are right, I wasn't in an async context! I was doing this:
static void Main(string[] args)
{
MainAsync(args);
}
static async void MainAsync(string[] args)
{
var manager = new ConnectionManager();
await manager.Connect();
Console.ReadLine();
}
But I needed to do this:
static void Main(string[] args)
{
MainAsync(args).Wait();
}
static async Task MainAsync(string[] args)
{
var manager = new ConnectionManager();
await manager.Connect();
Console.ReadLine();
}
Dumb mistake, clearly need to do more async work.
I bet people run into this a lot when they're getting started. I actually bounced off of this problem once before, months ago, and I'm just now playing with it again.
Anyway! Thanks for the help.
from slackconnector.
No problem, glad to have helped
from slackconnector.
Related Issues (20)
- Interactive Message HOT 4
- Error using Interactive Messages HOT 3
- Missing Message Type causing exception when connecting HOT 2
- OnMessageReceived not triggered by Webhook HOT 3
- SlackConnector and Noobot HOT 1
- Accessing user name instead of user HOT 1
- Question: Uploading File HOT 1
- Doesn't connect with proxy HOT 1
- LinkButton Support
- Missing file comment in incoming SlackFile HOT 4
- The Write method cannot be called when another write operation is pending HOT 3
- Unable to send attachments that are over a certain size
- TLS 1.2 HOT 6
- Cannot get SlackConnector to work with Slack TLS 1.2
- Missing SlackAttachmentAction type 'select'
- PingPongMonitor alive even after closing connection HOT 1
- chat.PostMessage: Switch to HTTP POST instead of GET HOT 1
- Getting "invalid_auth" error once I try to connect to slack but via Postman using App-Level Token it's working ! HOT 2
- Error occured while posting message 'method_deprecated' HOT 1
- ChatHub always null? HOT 1
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 slackconnector.