-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inter user communication #4
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comments:
- Prettify your HTML, Python and JS files. Follow the alignment and variable-naming conventions - people must find your code readable.
- PEP8 standard is used for Python files - you can use autopep8 tool to detect and fix most of your errors.
- README can be removed, or its content added to the existing README file (not necessary).
@@ -0,0 +1,5 @@ | |||
#inter-user communication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file might not be needed.
@@ -0,0 +1,9 @@ | |||
<html> | |||
<body> | |||
<form action = "http://localhost:5000/login" method = "get"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a relative path instead of a fixed one.
@@ -0,0 +1,27 @@ | |||
from flask import Flask,render_template,redirect,request,url_for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a white-space after every comma.
@app.route('/chat/<user>') | ||
def chat(user): | ||
return render_template('chat.html',user=user) | ||
app.config['SECRET_KEY'] = 'secret!' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All secret-keys can be kept in a file, and that file should not be committed.
socketio = SocketIO(app) | ||
@socketio.on('message') | ||
def handle_message(message): | ||
print(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the logging module from Python instead of print methods.
<body> | ||
<form action = "http://localhost:5000/login" method = "get"> | ||
<p>Enter Name:</p> | ||
<p><input type = "text" name = "nm" /></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can nm be changed to name ?
$("#messages").append('<li>'+msg+'</li>'); | ||
console.log('Received message'); | ||
}); | ||
$('#sendbutton').on('click', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sendButton instead of sendbutton. Notice the camel-case.
No description provided.