Jump to content
MakeWebGames

Integrate GoInstant - Real Time Chat Widget


sniko

Recommended Posts

I came across GoInstant via Twitter, and I really wanted to have a play with their API - especially their live chat system, as it looked awesome!

After tweeting about my excitement, they were quick to reply about how excited they were with what I could come up with.

Although it's not as huge as I'd like it to be on this release, I wanted to get other developers to start playing around with their API in the MWG community. I also hope to extend this release much further, after I've released a project of mine soon this year.

Below are a few screenshots of what I've accomplished in the short amount of time I set myself, which;

 

  • Supports in-game usernames
  • Supports in-game avatars

 

I really hope to integrate GoInstant into McCodes a lot further, by;

 

  • Offering a staff panel to open channels
  • Banning people from the chat
    • As in the chat won't render if they're banned

    [*] Allowing </commands> to be entered in the chat, such as;

    • /join <channel>
    • /leave <channel>
    • /kick <user>
    • /broadcast <message>

     

 

This will include manipulation on both GoInstant and McCodes, which I feel is very achievable, having worked with the engine for roughly three years.

 

goinstantmccodes.png

If you've not looked at GoInstant before, this chat is real-time, and awesome!

How to integrate it

It's very simple to integrate, and I'll dump the code I use, so you can just "plugin-and-chat".

 

  • Head over to GoInstant and register an account
  • Create an application via the Dashboard
  • Paste the following code into header.php in your McCodes files

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Make sure you change the following to your values;

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

And it's as easy as that!

Link to comment
Share on other sites

Looks really interesting! Looks like they've done the majority of the hard work already so it's really just plugging it in.

Just read your blog on the bus, very interesting. What made you go with it instead of Meteor or Node?

I'm going to guess as this already includes a chat widget really cutting down on development time.

Link to comment
Share on other sites

  • 3 weeks later...

Hey Sniko!

I just tried this out on my game, the minute I added it. I got 4 users already talking! Thats actually better then my old chats I added. But I have few problems. For example, I don't know how to delete messages?

Also if you can teach me to add staff colours (only the names), that would be great!

[ATTACH=CONFIG]1293[/ATTACH]

[ATTACH=CONFIG]1294[/ATTACH]

 

Problem also, sometimes when people send messages, there messages are spaced out?

[ATTACH=CONFIG]1295[/ATTACH]

921145999_ScreenShot2014-01-25at22_41_34.png.8f2c7786c2102a6bbe81246caf8299a1.png

1937284886_ScreenShot2014-01-25at22_41_23.png.3586ac83630d81c975e98b69a20be595.png

1080319982_ScreenShot2014-01-25at22_46_39.png.1c49449b19f2502dd4740c91fe388cdf.png

Edited by Revolution-NOTL
Link to comment
Share on other sites

Hey Sniko!

I just tried this out on my game, the minute I added it. I got 4 users already talking! Thats actually better then my old chats I added. But I have few problems. For example, I don't know how to delete messages?

Also if you can teach me to add staff colours, that would be great!

[ATTACH=CONFIG]1293[/ATTACH]

[ATTACH=CONFIG]1294[/ATTACH]

 

Problem also, sometimes when people send messages, there messages are spaced out?

[ATTACH=CONFIG]1295[/ATTACH]

 

The spacing itself looks like a tab, maybe copy and pasted from notepad and regarding staff colors, try wrapping some color around the displayname on .join

Edited by Guest
Link to comment
Share on other sites

The spacing itself looks like a tab, maybe copy and pasted from notepad and regarding staff colors, try wrapping some color around the displayname on .join

More looks like the chat message element has a text-align: justify; on it. Try overriding the styles and see if you can stop that.

Link to comment
Share on other sites

ive had a go at intergrating this, seems to be a little harder than i first thought. I can add in the <a href> links on the usernames, however they don't print as links, they print literally eg.

desired outcome : Spikereloaded

Actual outcome : <a href="viewuser.php?u=2">Spikereloaded</a>

same will go for changing username colour.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

anyone see what i'm doing wrong? or is it more complex than just wrapping it in a tag?

Link to comment
Share on other sites

ive had a go at intergrating this, seems to be a little harder than i first thought. I can add in the <a href> links on the usernames, however they don't print as links, they print literally eg.

desired outcome : Spikereloaded

Actual outcome : <a href="viewuser.php?u=2">Spikereloaded</a>

same will go for changing username colour.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

anyone see what i'm doing wrong? or is it more complex than just wrapping it in a tag?

Looks like GoInstant escapes HTML then, makes sense for security purposes, not had a real look but there should be some way to bypass it.

Link to comment
Share on other sites

  • 3 weeks later...

Hey guys,

This is good stuff! I'll try and answer as many of the questions right now but if you have any more, feel free to keep on posting here, tweet @goinstant, reach us directly or even through our docs.

@Revolution-NOTL & @Dayo, as you linked above, you can set custom colors https://developers.goinstant.com/v1/widgets/guides/colors.html

With regards to security and impersonation you can use JWTs to secure and enforce these things. Check out the JWT section on the colors page, https://developers.goinstant.com/v1/widgets/guides/colors.html#making-a-claim-in-the-jwt and I'd encourage you to checkout the section on Users and Authentication. https://developers.goinstant.com/v1/security_and_auth/guides/users_and_authentication.html#what-is-a-jwt?

With user authentication and JWTs you could easily enforce usernames, avatars, colors, and more. We have a PHP Library to help you build your JWTs and authenticate your users which you can find here: https://developers.goinstant.com/v1/security_and_auth/libraries/php.html

In PHP when you create the JWTs, you could set the color of admins to what ever you choose and prepend the display name with something to identify admins. This would now be part of the user and when the chat widget gets rendered, this information will automatically be in it without requiring more client side overrides.

Link to comment
Share on other sites

Hey guys,

This is good stuff! I'll try and answer as many of the questions right now but if you have any more, feel free to keep on posting here, tweet @goinstant, reach us directly or even through our docs.

@Revolution-NOTL & @Dayo, as you linked above, you can set custom colors https://developers.goinstant.com/v1/widgets/guides/colors.html

With regards to security and impersonation you can use JWTs to secure and enforce these things. Check out the JWT section on the colors page, https://developers.goinstant.com/v1/widgets/guides/colors.html#making-a-claim-in-the-jwt and I'd encourage you to checkout the section on Users and Authentication. https://developers.goinstant.com/v1/security_and_auth/guides/users_and_authentication.html#what-is-a-jwt?

With user authentication and JWTs you could easily enforce usernames, avatars, colors, and more. We have a PHP Library to help you build your JWTs and authenticate your users which you can find here: https://developers.goinstant.com/v1/security_and_auth/libraries/php.html

In PHP when you create the JWTs, you could set the color of admins to what ever you choose and prepend the display name with something to identify admins. This would now be part of the user and when the chat widget gets rendered, this information will automatically be in it without requiring more client side overrides.

This is true support!

Great stuff @GoInstant.

I do plan to make the improvements sometime soon - life is a little busy at the moment, but it'll tweet you once it's released!

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • 3 months later...
This is awesome Sniko Two thumbs up ~ !

Thanks [MENTION=68479]Oracle[/MENTION]!

 

Now that they are closing down now what?

I'm planning of creating a guide to integrate pusher, and perhaps a tiny admin panel to accompany it, but nothing is set in stone, yet.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...