82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/faye/protocol/server.rb', line 82
def handle(message, local = false, &callback)
return callback.call([]) if !message
info('Handling message: ? (local: ?)', message, local)
channel_name = message['channel']
error = message['error']
return handle_meta(message, local, &callback) if Channel.meta?(channel_name)
if Grammar::CHANNEL_NAME !~ channel_name
error = Faye::Error.channel_invalid(channel_name)
end
if message['data'].nil?
error = Faye::Error.parameter_missing('data')
end
@engine.publish(message) unless error
response = make_response(message)
response['error'] = error if error
response['successful'] = !response['error']
callback.call([response])
end
|