SlideShare a Scribd company logo
1 of 12
Download to read offline
MANGO CHAT




        Mango Chat Developer
             Guide 1.0
                 Startup guide for the developers
                                     Mango Chat Support Team
                                              2/1/2011




This document is a startup guide for the developers who want to integrate the Mango Chat .Net Ajax
based chat control to their websites.
Contents
Contents......................................................................................................................................2

Overview......................................................................................................................................3

Getting Started.............................................................................................................................3

Names and Avatars.....................................................................................................................7

Contact Lists................................................................................................................................8

Data Providers...........................................................................................................................10

Themes......................................................................................................................................11
Overview
Mango Chat is a full-featured ASP.NET chat component which allows website owners to add
chat functionality to their website. It includes features such as high load support, font/color/
customization, emoticons, and many more! The best thing about mango chat is that its a web
control and is as easy as a simple drag and drop for the website owners.


Getting Started
Integrating basic chat functionality to your website is super easy with MangoChat. Just follow
along.


Open your webpage where u want the chat to be available in ‘Design Mode’

**Tip**
You can use a masterpage if you need the chat control to be available on multiple pages.

Right Click on the the ASP.NET Toolbox and select ‘Add Tab’
Name it ‘MangoChat’

Right Click the ‘MangoChat’ tab and select ‘Choose Items’




Click ‘Browse’ on the ‘.NET Framework Components’ Tab




Select ‘ASPNETChatControl.dll’ from the ‘Open File’ dialog
Click OK to close the ‘Choose Toolbox Items’ dialog

You should now have the ‘ChatControl’ webcontrol displayed in the ‘MangoChat’ tab.




Drag the control onto the page

You’ll get a confirmation box asking if you wish to add the necessary configuration setting to the
web.config automatically. Click ‘Yes’ to continue
You should be able to see a placeholder for the chat control on your page on the lower right
hand corner of the page




Go to the code behind for this page and import the ‘ASPNETChatControl’ namespace

Type the following code inside the Page_Load event handler to start the chatting session on this
page:

ChatControl.StartSession();

This is how it should look like.
Run the application in two different browsers (e.g. Chrome and FireFox) to try it out.




This is all you need to get the control to work on your website. With a little more work you can
customize both the visual appearance and the behavior of the control to make it more integrated
into your website. You’ll be able to do things like:


Assign custom names to users instead of the default Guest-x naming scheme.
Assign custom avatars to the users
Create contact lists for users instead of showing everyone to everyone
Create custom data store providers for the control (NCache, MySQL, etc.)
Change the default theme of the chat UI to match the look and feel of your website

We’ll look at how to do these things in the next few sections.


Names and Avatars
Assigning a custom name or avatar image to a user is as easy as using a different overload of
the StartSession method that we saw in ‘Getting Started’.
So instead of using the following:

void ChatControl.StartSession();

use one of the following overloads to specify the username and/or the avatar image for the user

void ChatControl.StartSession(string username);
void ChatControl.StartSession(string username, string chatPhotoName);

The ‘username’ takes a string and sets it as the current users name.

The chatPhotoName takes a url string pointing to the desired avatar image for the current user.

You can pull this information from anywhere you want for e.g. from the user’s session variables
or a database.


Contact Lists
The default behavior of the chat control is to display all users to all users in their contact list.
While this might work for a demo or a really simple website, we think in most cases you’ll need
to customize this behavior. To do it just follow these steps:

First of all, we need to uniquely identify all the chat users and to do that we need to assign
unique ids to them. While the chat control does this itself out of the box but the ids that it
assigns to the users will be meaningless to your application. So first of all we have to assign
custom user ids to the users. To do this just use the following overload of the ‘StartSession’
method to provide a custom userId in addition to providing the username and the avatar.

public static void StartSession(string userId, string username, string
chatPhotoName);
OK, now lets move onto creating our custom contact list building logic.

Create a new class. Name it anything you like

Import the ‘ASPNETChatControl.Extensibility’ namespace.

Inherit the class from the ‘ContactListProvider’ base class.

Override the ‘GetContactsByUserId’ method.




This method will be called whenever the chat control needs to provide a contact list for a user. It
provides you the ‘userId’ for which it needs the contact list and in return you provide it a generic
Dictionary object of type ‘Dictionary<string, string>’ where the key is the ‘userId’ and the value is
the ‘username’ of the contact.

As you can see that by default it calls its base class version and simply returns the results. In
order to customize the behavior you need to implement your own logic inside this method.

**Tip**
If you need to access all currently available user sessions inside this method, you can call the
following method.

protected List<UserChatSession> GetAllSessions();

This provides you a list of ‘UserChatSession’ objects. UserChatSession is a simple class that
contains properties for a user’s session such as the user’s username, userid, avatar.

Now we need to tell MangoChat to use your ContactListProvider instead of the default one. To
do this

Add ‘Global.asax’ to the root of your website (If its not already there).
Import the ‘ASPNETChatControl’ namespace.

In the ‘Application_Start’ handler set your custom contact list provider as the one to be used as
follows

ChatControl.ContactListProvider = new MyContactListProvider();

Done.


Data Providers
MangoChat provides you with two chat data storage options out of the box.

In-Memory (Default)
Microsoft SQL Server

The In-Memory option offers the best performance but isn’t horizontally scalable. The SQL
Server option offers scalability with some performance overhead.

To use the in-memory data storage provide you don’t need to do anything as its the default data
provider.

If you want to use the SQL Server data storage provider, follow these steps.

In your web.config file add an appSetting with the following key

‘ASPNETChatControl.DAL.SqlServer.DSN’

and specify your SQL Server connection string as the value. For example:

<appSettings>
    <add key="ASPNETChatControl.DAL.SqlServer.DSN" value="Data
           Source=.SQLEXPRESS;Initial Catalog=ChatDB;User
                ID=sa;Password=xxx"/>
</appSettings>

Next, add the ‘Global.asax’ file to the root of your application (If you don’t have it there already)

Import the ‘ASPNETChatControl’ and ‘ASPNETChatControl.DAL.SqlServer’ namespaces in
your ‘Global.asax.cs’ file.

Set the SQL Server data provider in the ‘Application_Start’ handler as follows:
ChatControl.DataProvider = new SqlDataProvider();

Done.

While these should cover most of the applications out there, if you like to use something else
you have the option to do that too. In a nutshell you need to write a class, have it implement the
‘IChatDataProvider’ interface and let MangoChat know that you want to use it.

For more information on writing a custom data provider for mango chat, refer to the ‘Custom
Data Providers’ document.


Themes
MangoChat uses the jQuery UI CSS Framework to style itself. jQuery is the most used
javascript library due to its wide array for plugins and exceptional ease of use. jQuery UI is the
official set of UI widgets provider by the jQuery team.

What this means is that if you already use jQuery UI for your UI components, MangoChat can
automatically use the theme that you are using for your application. If not you can design a
custom theme using the brilliant ‘ThemeRoller’ tool provided by jQuery UI. You can find it at
http://jqueryui.com/themeroller/. Once you have designed your theme just press download and
you’ll get a zip file containing all the required css and image files.
Once you’ve imported the css files into your pages, you just need to do the following to have
MangoChat use it:

Open your page where you put the MangoChat control in ‘Design Mode’

Select the MangoChat control. It should be in the bottom right hand corner of the page.

Open the ‘Properties’ window and set ‘IncludeDefaultTheme’ property to ‘False’

Done.

More Related Content

Recently uploaded

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

ASP.NET Ajax Chat - Mango Chat Easy Integration

  • 1. MANGO CHAT Mango Chat Developer Guide 1.0 Startup guide for the developers Mango Chat Support Team 2/1/2011 This document is a startup guide for the developers who want to integrate the Mango Chat .Net Ajax based chat control to their websites.
  • 2. Contents Contents......................................................................................................................................2 Overview......................................................................................................................................3 Getting Started.............................................................................................................................3 Names and Avatars.....................................................................................................................7 Contact Lists................................................................................................................................8 Data Providers...........................................................................................................................10 Themes......................................................................................................................................11
  • 3. Overview Mango Chat is a full-featured ASP.NET chat component which allows website owners to add chat functionality to their website. It includes features such as high load support, font/color/ customization, emoticons, and many more! The best thing about mango chat is that its a web control and is as easy as a simple drag and drop for the website owners. Getting Started Integrating basic chat functionality to your website is super easy with MangoChat. Just follow along. Open your webpage where u want the chat to be available in ‘Design Mode’ **Tip** You can use a masterpage if you need the chat control to be available on multiple pages. Right Click on the the ASP.NET Toolbox and select ‘Add Tab’
  • 4. Name it ‘MangoChat’ Right Click the ‘MangoChat’ tab and select ‘Choose Items’ Click ‘Browse’ on the ‘.NET Framework Components’ Tab Select ‘ASPNETChatControl.dll’ from the ‘Open File’ dialog
  • 5. Click OK to close the ‘Choose Toolbox Items’ dialog You should now have the ‘ChatControl’ webcontrol displayed in the ‘MangoChat’ tab. Drag the control onto the page You’ll get a confirmation box asking if you wish to add the necessary configuration setting to the web.config automatically. Click ‘Yes’ to continue
  • 6. You should be able to see a placeholder for the chat control on your page on the lower right hand corner of the page Go to the code behind for this page and import the ‘ASPNETChatControl’ namespace Type the following code inside the Page_Load event handler to start the chatting session on this page: ChatControl.StartSession(); This is how it should look like.
  • 7. Run the application in two different browsers (e.g. Chrome and FireFox) to try it out. This is all you need to get the control to work on your website. With a little more work you can customize both the visual appearance and the behavior of the control to make it more integrated into your website. You’ll be able to do things like: Assign custom names to users instead of the default Guest-x naming scheme. Assign custom avatars to the users Create contact lists for users instead of showing everyone to everyone Create custom data store providers for the control (NCache, MySQL, etc.) Change the default theme of the chat UI to match the look and feel of your website We’ll look at how to do these things in the next few sections. Names and Avatars Assigning a custom name or avatar image to a user is as easy as using a different overload of the StartSession method that we saw in ‘Getting Started’.
  • 8. So instead of using the following: void ChatControl.StartSession(); use one of the following overloads to specify the username and/or the avatar image for the user void ChatControl.StartSession(string username); void ChatControl.StartSession(string username, string chatPhotoName); The ‘username’ takes a string and sets it as the current users name. The chatPhotoName takes a url string pointing to the desired avatar image for the current user. You can pull this information from anywhere you want for e.g. from the user’s session variables or a database. Contact Lists The default behavior of the chat control is to display all users to all users in their contact list. While this might work for a demo or a really simple website, we think in most cases you’ll need to customize this behavior. To do it just follow these steps: First of all, we need to uniquely identify all the chat users and to do that we need to assign unique ids to them. While the chat control does this itself out of the box but the ids that it assigns to the users will be meaningless to your application. So first of all we have to assign custom user ids to the users. To do this just use the following overload of the ‘StartSession’ method to provide a custom userId in addition to providing the username and the avatar. public static void StartSession(string userId, string username, string chatPhotoName);
  • 9. OK, now lets move onto creating our custom contact list building logic. Create a new class. Name it anything you like Import the ‘ASPNETChatControl.Extensibility’ namespace. Inherit the class from the ‘ContactListProvider’ base class. Override the ‘GetContactsByUserId’ method. This method will be called whenever the chat control needs to provide a contact list for a user. It provides you the ‘userId’ for which it needs the contact list and in return you provide it a generic Dictionary object of type ‘Dictionary<string, string>’ where the key is the ‘userId’ and the value is the ‘username’ of the contact. As you can see that by default it calls its base class version and simply returns the results. In order to customize the behavior you need to implement your own logic inside this method. **Tip** If you need to access all currently available user sessions inside this method, you can call the following method. protected List<UserChatSession> GetAllSessions(); This provides you a list of ‘UserChatSession’ objects. UserChatSession is a simple class that contains properties for a user’s session such as the user’s username, userid, avatar. Now we need to tell MangoChat to use your ContactListProvider instead of the default one. To do this Add ‘Global.asax’ to the root of your website (If its not already there).
  • 10. Import the ‘ASPNETChatControl’ namespace. In the ‘Application_Start’ handler set your custom contact list provider as the one to be used as follows ChatControl.ContactListProvider = new MyContactListProvider(); Done. Data Providers MangoChat provides you with two chat data storage options out of the box. In-Memory (Default) Microsoft SQL Server The In-Memory option offers the best performance but isn’t horizontally scalable. The SQL Server option offers scalability with some performance overhead. To use the in-memory data storage provide you don’t need to do anything as its the default data provider. If you want to use the SQL Server data storage provider, follow these steps. In your web.config file add an appSetting with the following key ‘ASPNETChatControl.DAL.SqlServer.DSN’ and specify your SQL Server connection string as the value. For example: <appSettings> <add key="ASPNETChatControl.DAL.SqlServer.DSN" value="Data Source=.SQLEXPRESS;Initial Catalog=ChatDB;User ID=sa;Password=xxx"/> </appSettings> Next, add the ‘Global.asax’ file to the root of your application (If you don’t have it there already) Import the ‘ASPNETChatControl’ and ‘ASPNETChatControl.DAL.SqlServer’ namespaces in your ‘Global.asax.cs’ file. Set the SQL Server data provider in the ‘Application_Start’ handler as follows:
  • 11. ChatControl.DataProvider = new SqlDataProvider(); Done. While these should cover most of the applications out there, if you like to use something else you have the option to do that too. In a nutshell you need to write a class, have it implement the ‘IChatDataProvider’ interface and let MangoChat know that you want to use it. For more information on writing a custom data provider for mango chat, refer to the ‘Custom Data Providers’ document. Themes MangoChat uses the jQuery UI CSS Framework to style itself. jQuery is the most used javascript library due to its wide array for plugins and exceptional ease of use. jQuery UI is the official set of UI widgets provider by the jQuery team. What this means is that if you already use jQuery UI for your UI components, MangoChat can automatically use the theme that you are using for your application. If not you can design a custom theme using the brilliant ‘ThemeRoller’ tool provided by jQuery UI. You can find it at http://jqueryui.com/themeroller/. Once you have designed your theme just press download and you’ll get a zip file containing all the required css and image files.
  • 12. Once you’ve imported the css files into your pages, you just need to do the following to have MangoChat use it: Open your page where you put the MangoChat control in ‘Design Mode’ Select the MangoChat control. It should be in the bottom right hand corner of the page. Open the ‘Properties’ window and set ‘IncludeDefaultTheme’ property to ‘False’ Done.